QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#748051#9544. Grand Prix of BallanceQingTian#RE 0ms3552kbC++201.3kb2024-11-14 19:10:342024-11-14 19:10:40

Judging History

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

  • [2024-11-14 19:10:40]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3552kb
  • [2024-11-14 19:10:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define int long long
int n,m,q;
struct node{
    int id,score;
};
void solve(){
    cin>>n>>m>>q;
    vector<bool> game_state(n+10,false);
    //map[id,x]
    map<pair<int,int>,int> mp;//1:complete,-1:giveup
    vector<int> game_rank(n+10,0);
    vector<node> player(n+10);
    for(int i=1;i<=m;i++){
        player[i].id=i;
    }
    while(q--){
        int op;cin>>op;
        if(op==1){
            int x;cin>>x;
            game_state[x]=1;
        }else if(op==2){

            int id,x;cin>>id>>x;
            if(!game_state[x]) continue;
            if(!mp[{id,x}]){
                mp[{id,x}]=1;

                player[id].score+=m-game_rank[x];
                game_rank[x]++;
            }
        }else{
            int id,x;cin>>id>>x;
            if(!game_state[x]) continue;
            if(!mp[{id,x}]){
                mp[{id,x}]=-1;
            }
        }
    }
    sort(player.begin()+1,player.begin()+m,[&](node a,node b){
        if(a.score==b.score) return a.id<b.id;
        return a.score>b.score;
    });

    for(int i=1;i<=m;i++){
        cout<<player[i].id<<' '<<player[i].score<<'\n';
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int _;cin>>_;
    while(_--) solve();
}

詳細信息

Test #1:

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

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:


result: