QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#718956#9544. Grand Prix of BallanceMLK2WA 0ms3556kbC++141.6kb2024-11-06 21:54:312024-11-06 21:54:35

Judging History

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

  • [2024-11-06 21:54:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3556kb
  • [2024-11-06 21:54:31]
  • 提交

answer

#include <bits/stdc++.h>
#define N (200000 + 10)  /*------------------ #define ------------------*/
#define M (400000 + 10)
#define MOD (1000000000 + 7)
//#define MOD (998244353)
#define INF (0x3f3f3f3f)
#define LNF (3e18)
#define mod(a,b) (((a)%(b)+(b))%(b))
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<int,LL> PIL;
typedef pair<LL,int> PLI;
typedef pair<double,double> PDD;

auto solve(){
	
	int n,m,Q;
	cin >> n >> m >> Q;
	
	vector<int> s(n + 1,0);
	int now_game = -1;
	int score = 0;
	set<int> dead;
	while(Q -- ){
		int op;
		cin >> op;
		if(op == 1){
			score = m;
			dead.clear();
			cin >> now_game;
		}else if(op == 2){
			int ix,game;
			cin >> ix >> game;
			if(dead.count(ix)) continue;
			if(game == now_game){
				//cout << "A\n";
				dead.insert(ix);
				s[ix] += score;
				if(score > 0) score -- ;
			}
		}else{
			int ix,game;
			cin >> ix >> game;
			if(dead.count(ix)) continue;
			if(game == now_game) dead.insert(ix);
		}
		//cout << "B : " << now_game << "\n";
	}
	
	vector<PII> ans;
	for(int i = 1;i <= m;i ++ ) ans.push_back({s[i] == -1 ? 0 : s[i],i});
	
	sort(ans.begin(),ans.end(),[&](PII a,PII b){
		if(a.fi != b.fi) return a.fi > b.fi;
		return a.se < b.se;
	});
	
	for(auto t : ans)
		cout << t.se << ' ' << t.fi << '\n';
}

signed main(){
	IOS
	int T = 1;
	cin >> T;
	while(T -- ) solve();
	//while(T -- ) cout << (solve() ? "YES" : "NO") << '\n';

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3556kb

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: 3556kb

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
3 7
7 7
1 0
2 0
4 0
5 0
6 0
1 3
2 0
3 0
9 21986
11 21986
14 49
6 33
1 0
2 0
3 0
4 0
5 0
7 0
12 0
13 0
15 0
16 0
8 -6310592
10 -6508528
6 33
1 0
2 0
3 0
4 0
5 0
7 0
8 0
9 21986
11 21986
19 21986
14 49
6 33
25 25
23 4
21 3
1 0
2 0
3 0
4 0
5 0
7 0
12 0
13 0
15 0
16 0
17 ...

result:

wrong answer 19th lines differ - expected: '1 0', found: '9 21986'