URAL 1718. Rejudge 题意讲解

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;
}
 

时间: 2024-10-12 16:44:04

URAL 1718. Rejudge 题意讲解的相关文章

思维题 URAL 1718 Rejudge

题目传送门 1 /* 2 题意:数据加10组,再删掉第6组数据,问rejudge后最少最多几个作者收到邮件 3 思维题:当错在6时结果是不一定,错在7时是一定改变,因为会变成6 4 思路没错,但用结构题排序一直WA,代码有毒!学习使用set容器. 5 */ 6 #include <cstdio> 7 #include <algorithm> 8 #include <cstring> 9 #include <cmath> 10 #include <str

URAL 1718 . Rejudge(数学啊 )

题目链接: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

URAL 1204. Idempotents 扩展欧几里德

题目来源:URAL 1204. Idempotents 题意:输入n(n = p*q p,q是质数) 并且x*x=x(mod n) 求x 思路: x*x=x(mod n)  -> x*x+k*n=x -> x*(x-1)/n = k 所以 0 和 1 是一组解 因为n = p*q 且x*(x-1)%(p*q)== 0 x < n 因为x*x%n == x 模n之后才是x 1.x有p因子x-1有q因子 x%p == 0且(x-1)%q == 0 a*p == x且b*q == x-1 得到

URAL 1470. UFOs 三维树状数组

题目来源:URAL 1470. UFOs 题意:求三维区间和 思路: #include <cstdio> #include <cstring> using namespace std; const int maxn = 130; int a[maxn][maxn][maxn]; int b[maxn][maxn][maxn]; int n, q; int lowbit(int x) { return x & -x; } void update(int x, int y, i

URAL 1176. Hyperchannels 欧拉回路

题目来源:URAL 1176. Hyperchannels 题意:求补图的欧拉回路 思路:模版 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxm = 40010; const int maxn = 1010; int first[maxn], cnt; struct edge { int u, v, next; }e[maxn*max

Uva 11991 Easy Prblem from Rujia Liu ?

[题意讲解] 本题讲的是给定一组数据,让你输出第k个v的下标.采用一般的方法本题是可以做出来的(数据(k,v)量较小).对于数据量较大的情况那么这种方法就不适用了(会浪费大量能够空间).那么我可以考虑使用一种叫map容器的方法.采用动态存储的方法,不浪费 空间. [map容器简介] 见c++map容器 简介 [本题代码] 1 #include<iostream> 2 #include<vector> 3 #include<map> 4 using namespace s

POJ 3311 Hie with the Pie(状压DP + Floyd)

题目链接:http://poj.org/problem?id=3311 Description The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hire only one driver to do the deliveries. He will wait fo

nyoj 460 项链 (区间dp)

项链 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述 在Mars星球上,每个Mars人都随身佩带着一串能量项链.在项链上有N颗能量珠.能量珠是一颗有头标记与尾标记的珠子,这些标记对应着某个正整数.并且,对于相邻的两颗珠子,前一颗珠子的尾标记一定等于后一颗珠子的头标记.因为只有这样,通过吸盘(吸盘是Mars人吸收能量的一种器官)的作用,这两颗珠子才能聚合成一颗珠子,同时释放出可以被吸盘吸收的能量.如果前一颗能量珠的头标记为m,尾标记为r,后一颗能量珠的头标记为r,尾标

POJ 2348 Euclid Game (模拟题)

Euclid's Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7942   Accepted: 3227 Description Two players, Stan and Ollie, play, starting with two natural numbers. Stan, the first player, subtracts any positive multiple of the lesser o