QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#716463#9544. Grand Prix of Ballanceafeng111#WA 1ms5692kbC++201.0kb2024-11-06 15:19:482024-11-06 15:19:48

Judging History

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

  • [2024-11-06 15:19:48]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5692kb
  • [2024-11-06 15:19:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+7;
const int mod=998244353;
const int M=2e6+7;

struct node{
	int id,val;
}a[N];
int vis[N];

bool cmp(node a,node b){
	if(a.val!=b.val)return a.val>b.val;
	else return a.id<b.id;
}
set<int> st;
void solve()
{
	st.clear();
	int n,m,q;
	cin>>n>>m>>q;
	for(int i=1;i<=m;i++){
		a[i].id=i;
		a[i].val=0;
		vis[i]=0;
	}
	int now=-1;
	int sum=m;
	while(q--){
		int k;
		cin>>k;
		if(k==1){
			int t;
			cin>>t;
			if(!st.count(t)){
				now=t;
				sum=m;
				st.insert(now);
			}
			
		}
		else if(k==2){
			int p,x;
			cin>>p>>x;
			if(x==now&&vis[p]!=now){
				a[p].val+=sum;
				vis[p]=now;
				sum--;
			}
		}
		else if(k==3){
			int p,x;
			cin>>p>>x;
			if(x==now)vis[p]=now;
		}
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=m;i++){
		cout<<a[i].id<<" "<<a[i].val<<"\n";
	}
}

signed main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	int t=1;
	cin>>t;
	while(t--)
	{
		solve();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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
Wrong Answer
time: 0ms
memory: 3712kb

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:

0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
3 7
7 7
0 0
0 0
0 0
0 0
0 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
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
25 25
1 0
2 0
...

result:

wrong answer 1st lines differ - expected: '1 0', found: '0 0'