1718. Rejudge
Time limit: 0.5 second
Memory limit: 64 MB
At three o’clock in the morning Sasha (aka Sandro) discovered that there were only seven tests for one of the problems in the first volume of the Timus Online Judge. “That won’t do,”
Sasha thought and added ten new tests for that problem. At four o’clock in the morning, Vova (aka Vladimir Yakovlev) discovered that the sixth test in the same problem was incorrect. “That won’t do,” Vova thought and deleted the sixth test.
The next day Sasha and Vova came to work at two o’clock in the afternoon. After some discussion they decided to rejudge all the solutions for that problem that had been submitted before the moment Sasha
added new tests.
After the rejudge each author receives an e-mail with the list of all her solutions for which the outcome has changed. If that list is empty the e-mail is not sent. Help Sasha and Vova determine the
minimal possible and maximal possible number of authors who will receive an e-mail with the rejudge results.
Input
The first line contains the number of solutions n that Sasha and Vova want to rejudge (1 ≤ n ≤ 1000). Each of the following n lines describes one solution and contains the
name of its author and the previous outcome.
The name of the author is a nonempty string of length not exceeding 30. It may contain Latin letters, digits, the underscore character, parentheses and square brackets. It is guaranteed that no two
different authors have names which differ only in case of the letters.
The possible outcomes are: AC, CE, ML X, TL X, and WA X, where X is an integer from 1 to 7. The outcome AC means that the solution passed all the tests. The outcome CE means that the solution failed
to compile and, therefore, was not launched on any of the tests. The outcomes ML X, TL X, and WA X mean that the solution passed the tests with numbers less than X but failed to pass the test X because it exceeded the memory limit or the time limit or because
it produced a wrong answer. The outcomes which differ only in test number are considered different.
Output
Output the minimal possible and maximal possible number of authors who will receive e-mails with the rejudge results.
Sample
input | output |
---|---|
5 [SPbSU_ITMO]_WiNGeR TL 6 Milanin_(TNU) WA 6 Vladimir_Yakovlev_(USU) AC Sandro_(USU) WA 1 Sandro_(USU) ML 3 |
0 3 |
题意:oj管理员发现一道题目的数据出错了。这道题原来有7组数据。管理员删去了第6组,又新增了10组。然后进行rejudge,判断最多和最少有几个人的outcome,也就是判题结果 会改变。
输入n,代表有n次提交。然后是提交人的ID,然后是判题结果,除了AC或者CE,结果会多一个数字,代表在第几组数据里出错。
因为开始只有7组数据,所以原始的TL WA ML这些错误只可能错在1-7 这些数据里。
注意如果是数字改变也算是结果改变了。
做法:如果CE肯定是不会改变outcome的。如果AC了,那么新数据来了,outcome可能会改变,所以最大可能数+1。 如果错在前五组数据是不会改变结果的。如果错在第6组,那么可能会改变结果,也可能不会。如果错在第7组,则一定会改变答案。因为删去第6组数据后,第七组数据代替了第六组数据。如果本来是WA 7,那么重判后一定会是 WA 6。
set <string> my2,my; string name,sta; int main() { int n; while(scanf("%d",&n)!=EOF) { my2.clear(); my.clear(); for(int i=0;i<n;i++) { cin>>name>>sta; if(sta=="CE") continue; else if(sta=="AC")//可能变 { my2.insert(name); continue; } else { int tem; cin>>tem; if(tem==6)//状态可能变 { //my.insert(name); my2.insert(name); } if(tem==7)//一定不变 数字变可能也算 { my.insert(name); my2.insert(name); } } } printf("%d %d\n",my.size(),my2.size()); } return 0; }