POJ 1581 A Contesting Decision

2024-06-15 14:58
文章标签 poj decision 1581 contesting

本文主要是介绍POJ 1581 A Contesting Decision,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

英文烂果然是硬伤啊。。。水题都要提交3次!!!

Description

Judging a programming contest is hard work, with demanding contestants, tedious decisions,and monotonous work. Not to mention the nutritional problems of spending 12 hours with only donuts, pizza, and soda for food. Still, it can be a lot of fun. 
Software that automates the judging process is a great help, but the notorious unreliability of some contest software makes people wish that something better were available. You are part of a group trying to develop better, open source, contest management software, based on the principle of modular design. 
Your component is to be used for calculating the scores of programming contest teams and determining a winner. You will be given the results from several teams and must determine the winner. 
Scoring 
There are two components to a team's score. The first is the number of problems solved. The second is penalty points, which reflects the amount of time and incorrect submissions made before the problem is solved. For each problem solved correctly, penalty points are charged equal to the time at which the problem was solved plus 20 minutes for each incorrect submission. No penalty points are added for problems that are never solved. 
So if a team solved problem one on their second submission at twenty minutes, they are charged 40 penalty points. If they submit problem 2 three times, but do not solve it, they are charged no penalty points. If they submit problem 3 once and solve it at 120 minutes, they are charged 120 penalty points. Their total score is two problems solved with 160 penalty points. 
The winner is the team that solves the most problems. If teams tie for solving the most problems,then the winner is the team with the fewest penalty points.

Input

For the programming contest your program is judging, there are four problems. You are guaranteed that the input will not result in a tie between teams after counting penalty points. 
Line 1 < nTeams > 
Line 2 - n+1 < Name > < p1Sub > < p1Time > < p2Sub > < p2Time > ... < p4Time > 
The first element on the line is the team name, which contains no whitespace.Following that, for each of the four problems, is the number of times the team submitted a run for that problem and the time at which it was solved correctly (both integers). If a team did not solve a problem, the time will be zero. The number of submissions will be at least one if the problem was solved.

Output

The output consists of a single line listing the name of the team that won, the number of problems they solved, and their penalty points.

Sample Input

4
Stars 2 20 5 0 4 190 3 220
Rockets 5 180 1 0 2 0 3 100
Penguins 1 15 3 120 1 300 4 0
Marsupials 9 0 3 100 2 220 3 80

Sample Output

Penguins 3 475


代码

#include <iostream>
#include <cstring>
#include <string>
#include <climits>using namespace std;int main()
{int n,sub,time,firstsub,firsttime,i,j,k;string team,firstteam;cin>>n;firstsub=0;firsttime=INT_MAX;while(n--){cin>>team;j=k=0;for(i=0;i<4;i++){cin>>sub>>time;if(time>0){j=j+time+(sub-1)*20;++k;}}
/*cout<<team<<" "<<k<<" "<<j<<endl;
*/if((k>firstsub) || (k==firstsub && j<firsttime) || 0==i){firstteam=team;firstsub=k;firsttime=j;}}cout<<firstteam<<" "<<firstsub<<" "<<firsttime<<endl;return 0;
}


最后贴个图出来





这篇关于POJ 1581 A Contesting Decision的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1063776

相关文章

poj 3882(Stammering Aliens) 后缀数组 或者 hash

后缀数组:  构建后缀数组,注意要在字符串莫末尾加上一个没出现过的字符。然后可以2分或者直接扫描,直接扫描需要用单调队列来维护 VIEW CODE #include<cstdio>#include<algorithm>#include<iostream>#include<cmath>#include<queue>#include<stack>#include<string

poj 3294(Life Forms) 2分+ 后缀数组

我曾用字符串hash写,但是超时了。只能用后最数组了。大致思路:用不同的符号吧字符串连接起来,构建后缀数组,然后2分答案,依次扫描后缀数组,看是否瞒住条件。 VIEW CODE #include<cstdio>#include<vector>#include<cmath>#include<algorithm>#include<cstring>#include<cassert>#

poj 2391 Ombrophobic Bovines (网络流)

这是一道很经典的网络流的题目。首先我们考虑假如我们的时间为无穷大。我们吧每个点拆成2个点 i和i' .。虚拟源点s和汇点t。对于每个点建边(s,i, a[i])  (i‘,t,ib[i]) 。 其中a[i]为给点有多少牛,b[i]为容量。i和j连通 建边 (i,j',inf);如果最大流==所有牛的个数,就可能装下所有的牛。那么现在我们考虑时间。假设最大时间为T.那么如果i到j的的最短时间>T

poj 1330 LCA 最近公共祖先

水题目。直接上代码了。 VIEW CODE #include<cstdio>#include<algorithm>#include<iostream>#include<cmath>#include<queue>#include<stack>#include<string>#include<cstring>#include<map>#include<vector>#

poj 3160 Father Christmas flymouse 强连通+dp

首先我们可以确定的是,对于val值小于0的节点都变成0.   假设一个集合内2个房间都能任意到达,那么我就可以吧集合内的所有点的价值都取到,并且可以达到任一点。实际上集合内的每个点是相同的,这样的集合就是一个强连通分量。 那么我们就可以用tarjin算法进行强连通缩点, 最后形成一个dag的图。在dag的图上面进行dp。可以先用拓扑排序后dp。或者建反响边记忆化搜索 。 VIEW

poj 1564 Sum It Up -- DFS 递归

题意:给一个数 t ,以及 n 个数,求 n 个数中的几个数加起来的和为 t 的情况有多少种。 注意:题目要求相同的组合方式不能出现2次,即 “3 4 1 1 1 1 ” 的结果为:“1+1+1”。 思路:一个  for  循环遍历一遍,每个 i 表示以当前数为起点开始一次DFS递归,当所遍历的和为 t 时,输出该组合方式,如果大于 t 则返回,小于则往下递归。以二维数组保存已经输出过的数据,

道路 Road(百练,POJ)

题目链接: 1724 -- ROADS (poj.org) 题目描述: 思路: 这题目乍一看,是一个含有2个标尺的单源最短路问题,挺难处理的。 既然没法直接用最短路处理,那我们就“记录信息”,将花费的时间也记录进dp数组,然后跑“状态最短路”。 用f[i][j] 表示到达点i 且 总花费时间为j的最短距离,然后跑堆优化的dijkstra算法就好。由于不含有负边权,因此可以搞一个vis数

[POJ 1284] Primitive Roots (数论,原根)

POJ - 1284 题意是,求一个质数的原根 原根的定义是,对于正整数 aimodp(i=[1,p−1]) a^i mod p (i=[1,p-1])得到的集合为{1,2,…,p-1},那么则称 a是 p的一个原根 对于任意正整数 p,其原根个数为 ϕ(ϕ(p)) \phi( \phi(p) ), ϕ(n) \phi(n)为欧拉函数,表示小于n且与n互质的数的个数 而质数的欧拉函数值

[POJ 3764] The xor-longest Path (Tire树 + 贪心)

POJ - 3674 题意是给你一个树,每条边有一个权值,求得树上一条路径,使路径上每条边权值的异或和最大 首先用一个 DFS把根到任意点的路径的异或和求出来 xorv[i] 由异或的性质可得点 u和点 v的异或和即为 xorv[u]^xorv[v] ( 根到两点 LCA的异或和会消去) 然后问题就转化成在区间内找两个值,使得他们的异或和最大 与 LightOJ - 1269一样的做法,

[POJ 3045] Cow Acrobats (贪心)

POJ - 3045 有若干头牛叠罗汉,每头牛有一个冒险值,为在其上面所有牛的重量,减去其力量值 问如何使得最大的冒险值最小 挑战上面的题,本来想着用二分答案的方法做 虽然觉得自己的思路没什么问题,但是 WA了 百度了一发题解,发现这题正解是贪心 首先直观感觉力量大的,体重轻的应该在下面,但这有两个因素,不好确定 可利用调整法试图找出答案 假设我已经找到了答案排列 ( 猜想答案序列