标签:ural 数学
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1718
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
|
代码如下:
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
set<string>n1, n2;
int main()
{
int n;
string a, s;
int num;
while(~scanf("%d",&n))
{
n1.clear();
n2.clear();
for(int i = 0; i < n; i++)
{
cin >> a;
cin >> s;
if(s!="AC" && s!="CE")
scanf("%d",&num);
if(s == "AC")
{
n2.insert(a);
}
if(s == "TL" || s == "ML" || s == "WA")
{
if(num == 7)//一定收到
{
n1.insert(a);
}
if(num >= 6)
{
n2.insert(a);
}
}
}
printf("%d %d\n",n1.size(),n2.size());
}
return 0;
}
URAL 1718 . Rejudge(数学啊 )
标签:ural 数学
原文地址:http://blog.csdn.net/u012860063/article/details/44134971