QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#721194#9544. Grand Prix of Ballancesurenjamts#RE 1ms4572kbC++141.0kb2024-11-07 15:32:262024-11-07 15:32:26

Judging History

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

  • [2024-11-07 15:32:26]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:4572kb
  • [2024-11-07 15:32:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m,q;
vector<int> v(200005);
bool cmp(const pair<int,int> &a, const pair<int,int> &b){
	if(a.first>b.first){
		return true;
	}
	else{
		return a.second<b.second;
	}
}
void solve(){
	cin>>n>>m>>q;
	for(int i=0; i<=m; i++){
		v[i]=0;
	}
	set<int> s;//finished
	int tmp=0;
	int curlvl=-1;
	while(q--){
		int t, id, x, lvl;
		cin>>t;
		if(t==1){
			cin>>curlvl;
			tmp=m;
			s.clear();
		}
		else{
			cin>>id>>x;
			if(t==2){
				if(curlvl!=x) continue;
				if(s.count(id)){
					continue;
				}
				else{
					v[id]+=tmp;
					s.insert(id);
					tmp--;
				}
			}
			else{
				s.insert(id);
			}
		}
	}
	vector<pair<int,int>> ans;
	for(int i=1; i<=m; i++){
		ans.push_back({v[i],i});
	}
//	cout<<"ANSLALRAA"<<endl;
	sort(ans.begin(),ans.end(),cmp);
	for(int i=0; i<ans.size(); i++){
		cout<<ans[i].second<<" "<<ans[i].first<<endl;
	}
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	int t;
	cin>>t;	
	while(t--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
3 4 6
1 2
2 1 1
2 2 2
3 3 2
2 3 2
2 1 2
3 4 8
1 2
2 1 1
2 2 2
3 3 2
2 3 2
2 1 2
1 1
2 1 1
3 4 7
1 2
2 1 1
2 2 2
3 3 2
2 3 2
2 1 2
1 1

output:

2 4
1 3
3 0
4 0
1 7
2 4
3 0
4 0
2 4
1 3
3 0
4 0

result:

ok 12 lines

Test #2:

score: -100
Runtime Error

input:

10
18 8 8
2 1 6
1 13
2 1 18
3 8 13
2 7 14
2 5 11
3 6 13
3 1 13
26 7 11
1 22
2 7 22
1 9
2 6 24
1 2
1 18
3 3 4
2 3 18
1 26
3 7 1
3 2 26
1 3 33
3 3 1
2 3 1
2 2 1
1 1
2 1 1
2 1 1
3 1 1
3 3 1
3 2 1
3 3 1
2 2 1
2 2 1
3 3 1
2 2 1
2 2 1
3 3 1
2 3 1
2 3 1
3 3 1
2 3 1
2 2 1
2 2 1
2 2 1
2 1 1
3 2 1
2 2 1
3 2 1...

output:

1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
7 7
1 0
2 0
3 0
4 0
5 0
6 0
1 3
2 0
3 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
529 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
21 0
22 0
23 0
24 0

result: