QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#137301#2358. What? Subtasks? Again?silly_1_2_3#WA 12ms4900kbC++11753b2023-08-10 10:00:592023-08-10 10:01:02

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-10 10:01:02]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:4900kb
  • [2023-08-10 10:00:59]
  • 提交

answer

#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a),i##z=(b);i<=i##z;i++)
#define ROF(i,a,b) for(int i=(a),i##z=(b);i>=i##z;i--)
#define REP(i,u) for(int i=hd[u],v;v=to[i],i;i=nxt[i])
#define temT template<typename T>
#define temT12 template<typename T1,typename T2>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef long double ld;

int n,m,K; unordered_set<int> s[5]; int a[5]; int ans;

int main(){
	cin>>n>>m>>K;
	for(int i=1,t,v;i<=K;i++)
		cin>>t>>v,s[v-1].insert(t);
	FOR(i,0,4) a[i]=s[i].size();
	ans=-1;
	FOR(i,0,(1<<5)-1){
		int tmp=n;
		FOR(j,0,4) if((i>>j)&1) tmp-=a[j];
		if(tmp<=m) ans=max(ans,tmp);
	}
	if(ans==-1){ cout<<"Round will be unrated"; }
	else cout<<ans;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3432kb

input:

10 7 10
2 1
3 5
2 1
4 1
9 5
5 4
6 4
7 4
8 4
10 4

output:

6

result:

ok single line: '6'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3444kb

input:

10 9 0

output:

Round will be unrated

result:

ok single line: 'Round will be unrated'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3500kb

input:

5 4 3
4 1
4 2
1 2

output:

4

result:

ok single line: '4'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3432kb

input:

2 1 2
1 1
2 1

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3452kb

input:

2 1 10
1 1
1 1
2 1
2 4
2 4
1 4
1 3
2 4
2 1
1 4

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 8ms
memory: 4256kb

input:

5002 4187 25010
4625 3
2753 4
1909 5
2193 3
1939 1
2193 5
269 5
2802 3
3616 2
218 5
2969 5
1644 4
235 3
3045 5
2434 4
3582 4
886 5
2144 1
1968 3
2158 3
585 3
1102 2
3309 1
2157 2
2703 3
4627 5
2593 2
1705 5
508 5
4430 3
2900 2
2445 3
1351 1
3486 5
4910 1
3970 1
3573 4
4541 4
3726 4
291 2
1720 5
4371...

output:

1855

result:

ok single line: '1855'

Test #7:

score: -100
Wrong Answer
time: 12ms
memory: 4900kb

input:

10002 273 50010
4756 5
4869 4
6441 3
7925 2
4945 2
9051 4
7660 4
9008 1
530 3
9609 3
5984 4
6590 1
1373 5
3462 4
5632 1
2733 3
4579 2
6421 5
2772 1
3238 5
3872 4
6837 4
9778 5
8566 1
2837 5
1125 2
3490 1
3730 2
567 1
3041 1
968 3
5109 4
5980 4
7420 4
9707 2
8285 2
4935 1
2613 5
6436 2
335 4
4731 5
9...

output:

Round will be unrated

result:

wrong answer 1st lines differ - expected: '196', found: 'Round will be unrated'