ICPC 7014 Ideal Scoreboard
来源:互联网 发布:php公众号自定义菜单 编辑:程序博客网 时间:2024/05/16 07:43
Professor Boffin is a regional contest director of ACM ICPC. He loves watching and analyzing the scoreboard during the contest. He believes that the scoreboard is ideal when all these criteria hold together: • Each team has solved at least one problem. • No team has solved all the problems. • Each problem is solved by at least one team. • No problem is solved by all the teams.
Obviously, the scoreboard is not ideal at the beginning of the contest, but it may become ideal during the contest. The scoreboard may remain ideal through the end of the contest, or it may lose this property some time later during the contest. In the latter case, it can be shown that it will never become ideal any more. Given the list of the submissions in a regional contest, you must determine the interval in which the scoreboard was ideal.
Input
The input consists of several test cases. Each test case starts with a line containing 3 space- separated integers T, P, and S which represent the number of teams, problems, and submissions respectively (1 ≤ T ≤ 150, 1 ≤ P ≤ 15, 0 ≤ S ≤ 5000). Each of the next S lines represents a contest submission with 4 space-separated parameters
• teamID: the identifier of the team, an integer in the range [1..T]. • problemID: the identifier of the problem, an uppercase letter from the first P letters of English alphabet. • submission−time: the time of submission, in ‘HH:MM:SS’ format, all 3 parts are exactly 2 digits (00 ≤ HH ≤ 05, 00 ≤ MM,SS ≤ 59). • result: the result of the submission. It can be one of the following sentences:
– Yes: Only this case shows that the corresponding team has successfully solved the problem. – No - Compilation Error: Unsuccessful submission due to a compilation error in the submitted program. – No - Wrong Answer: Unsuccessful submission since the submitted program had a wrong output. – No - Run-time Error: Unsuccessful submission due to a run-time error during the execution of the submitted program. – No - Time Limit Exceeded: Unsuccessful submission since the execution of the submitted program did not finish in the time limit. – No - Presentation Error: Unsuccessful submission due to a formatting error in the output of the submitted program.
No two submissions have the same time. The input terminates with a line containing ‘0 0 0’ which should not be processed as a test case.
Output
For each test case, output a line containing the ideal-interval of the corresponding contest. The interval must be provided with two times in exact ‘HH:MM:SS’ format (as described in the input). The first time shows the moment the scoreboard becomes ideal, and the second time shows the moment the scoreboard is not ideal anymore. If the scoreboard remains ideal through the end of the contest, the second time must be ‘--:--:--’. If the scoreboard never becomes ideal throughout the contest, both times must be ‘--:--:--’.
Sample Input
2 3 5 1 A 00:10:05 Yes 2 A 00:15:15 No - Wrong Answer 1 C 01:01:01 Yes 2 B 02:20:00 Yes 1 B 03:10:00 Yes 2 3 5 1 A 00:10:05 Yes 2 A 00:15:15 No - Wrong Answer 1 C 01:01:01 Yes 2 B 02:20:00 Yes 1 B 03:10:00 No - Wrong Answer 2 3 5 1 A 00:10:05 Yes 1 C 01:01:01 Yes 2 A 00:15:15 No - Wrong Answer 1 B 03:10:00 Yes 2 B 04:20:00 Yes 0 0 0
Sample Output
Obviously, the scoreboard is not ideal at the beginning of the contest, but it may become ideal during the contest. The scoreboard may remain ideal through the end of the contest, or it may lose this property some time later during the contest. In the latter case, it can be shown that it will never become ideal any more. Given the list of the submissions in a regional contest, you must determine the interval in which the scoreboard was ideal.
Input
The input consists of several test cases. Each test case starts with a line containing 3 space- separated integers T, P, and S which represent the number of teams, problems, and submissions respectively (1 ≤ T ≤ 150, 1 ≤ P ≤ 15, 0 ≤ S ≤ 5000). Each of the next S lines represents a contest submission with 4 space-separated parameters
• teamID: the identifier of the team, an integer in the range [1..T]. • problemID: the identifier of the problem, an uppercase letter from the first P letters of English alphabet. • submission−time: the time of submission, in ‘HH:MM:SS’ format, all 3 parts are exactly 2 digits (00 ≤ HH ≤ 05, 00 ≤ MM,SS ≤ 59). • result: the result of the submission. It can be one of the following sentences:
– Yes: Only this case shows that the corresponding team has successfully solved the problem. – No - Compilation Error: Unsuccessful submission due to a compilation error in the submitted program. – No - Wrong Answer: Unsuccessful submission since the submitted program had a wrong output. – No - Run-time Error: Unsuccessful submission due to a run-time error during the execution of the submitted program. – No - Time Limit Exceeded: Unsuccessful submission since the execution of the submitted program did not finish in the time limit. – No - Presentation Error: Unsuccessful submission due to a formatting error in the output of the submitted program.
No two submissions have the same time. The input terminates with a line containing ‘0 0 0’ which should not be processed as a test case.
Output
For each test case, output a line containing the ideal-interval of the corresponding contest. The interval must be provided with two times in exact ‘HH:MM:SS’ format (as described in the input). The first time shows the moment the scoreboard becomes ideal, and the second time shows the moment the scoreboard is not ideal anymore. If the scoreboard remains ideal through the end of the contest, the second time must be ‘--:--:--’. If the scoreboard never becomes ideal throughout the contest, both times must be ‘--:--:--’.
Sample Input
2 3 5 1 A 00:10:05 Yes 2 A 00:15:15 No - Wrong Answer 1 C 01:01:01 Yes 2 B 02:20:00 Yes 1 B 03:10:00 Yes 2 3 5 1 A 00:10:05 Yes 2 A 00:15:15 No - Wrong Answer 1 C 01:01:01 Yes 2 B 02:20:00 Yes 1 B 03:10:00 No - Wrong Answer 2 3 5 1 A 00:10:05 Yes 1 C 01:01:01 Yes 2 A 00:15:15 No - Wrong Answer 1 B 03:10:00 Yes 2 B 04:20:00 Yes 0 0 0
Sample Output
02:20:00 03:10:00 02:20:00 --:--:---:--:-- --:--:-
题意:给定一场比赛的情况。满足以下四个条件的时间为ideal时间。
• Each team has solved at least one problem. • No team has solved all the problems. • Each problem is solved by at least one team. • No problem is solved by all the teams.
求一场比赛的时候,满足IDEA的时间段。
#include<cstdio>#include<algorithm>#include<cstring>#include<iostream>#define N 150005#define M 305int table[200][20];using namespace std;int t,p,s;int flag11,flag12,flag13,flag21,flag22,flag23;typedef struct ed{int num_team,num_p,t1,t2,t3,time;}ed;ed ans[6000];int solve(){//int cnt;for(int i = 1;i<=t;i++){cnt = 0;for(int j = 0;j < p;j++){if(table[i][j]!=-1)cnt++;}//cout<<cnt<<endl;if(cnt>0&&cnt<p)continue;elsereturn 0;}for(int i = 0;i<p;i++){cnt = 0;for(int j = 1;j <= t;j++){if(table[j][i]!=-1)cnt++;}//cout<<cnt<<endl;if(cnt>0&&cnt<t)continue;elsereturn 0;}return 1;}bool cmmp(ed a,ed b){return a.time<b.time;}int main(){while(scanf("%d%d%d",&t,&p,&s)==3){if(t==0&&p==0&&s==0)break;memset(table,-1,sizeof(table));memset(ans,-1,sizeof(ans));flag11 = -1;flag21 = -1;int tt = 0;for(int i = 0;i<s;i++){int num_team,num_p,num_time,t1,t2,t3;char num_pro;string ss;scanf("%d %c %d:%d:%d ",&num_team,&num_pro,&t1,&t2,&t3);cin >> ss;if(ss=="Yes"){num_p = num_pro-'A';num_time = ((t1*60)+t2)*60+t3;ans[tt].num_team = num_team;ans[tt].num_p = num_p;ans[tt].t1 = t1;ans[tt].t2 = t2;ans[tt].t3 = t3;ans[tt].time = num_time;tt++;}else{cin>>ss;cin >>ss;if(ss=="Time")cin >> ss;cin>>ss;}}sort(ans,ans+tt,cmmp);for(int i = 0;i<tt;i++){table[ans[i].num_team][ans[i].num_p] = ans[i].time;int k;k = solve();//cout<<"///"<<k<<endl;if(k&&flag11==-1){flag11 = ans[i].t1;flag12 = ans[i].t2;flag13 = ans[i].t3;}if(k==0&&flag11!=-1&&flag21==-1)//这里还有一个条件FLLAG21==-1忘了加,所以一直WA{flag21 = ans[i].t1;flag22 = ans[i].t2;flag23 = ans[i].t3;}}if(flag11==-1)cout<<"--:--:-- ";elseprintf("%02d:%02d:%02d ",flag11,flag12,flag13);//cout<<flag11<<":"<<flag12<<":"<<flag13<<" ";if(flag21==-1)cout<<"--:--:--\n";elseprintf("%02d:%02d:%02d\n",flag21,flag22,flag23);//cout<<flag21<<":"<<flag22<<":"<<flag23<<endl;}return 0;}
0 0
- ICPC 7014 Ideal Scoreboard
- ideal
- Contest Scoreboard
- Rotating Scoreboard
- Ideal education
- Ideal codeTempalte
- ideal 快捷键
- ideal激活
- ideal破解
- fjnu 1557 Contest Scoreboard
- poj 3335 Rotating Scoreboard
- Datastream scoreboard iterators
- uva 10258 - Contest Scoreboard
- UVa 10258 - Contest Scoreboard
- POJ 3335 Rotating Scoreboard
- 10258 - Contest Scoreboard
- UVA 10258 Contest Scoreboard
- UVA 10258 Contest Scoreboard
- Leetcode233 Number of Digit One
- swift详解之二十--------在xcode中使用git管理源代码,将代码提交到github
- 浅析C#中接口的重要性
- 未知情况的笔记本蓝屏记录
- web-javascript出现的全局变量的问题(*)
- ICPC 7014 Ideal Scoreboard
- CRM_ORDER_READ 订单查询简单示例
- PHP的命令行脚本开发
- 自定义带删除按钮的EditText搜索框
- c/c++学习的经典网站
- 学会看外面的风景
- 【转】XA事务规范
- Js 代替eval的方法
- python setup.py安装出错: error: Unable to find vcvarsall.bat