QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#716904#9544. Grand Prix of Ballancefgz#WA 0ms3656kbC++231.6kb2024-11-06 16:19:012024-11-06 16:19:01

Judging History

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

  • [2024-11-06 16:19:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3656kb
  • [2024-11-06 16:19:01]
  • 提交

answer

#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(0), cin.tie(0)
// #define int long long 
#define pb push_back
#define fi first
#define se second
using namespace std;


typedef pair<int, int> PII;

void solve(){
    int n, m, q;
    cin >> n >> m >> q;

    vector<int> hs;
    vector<int> ans(m + 10, 0), gs(m + 10, 0);

    int tm = m, now;
    for(int i = 1; i <= q; i ++){
        int tp;
        cin >> tp;
        int id, tnow;
        if(tp == 1){
            tm = m;
            for(auto x : hs)
                gs[x] = 0;
            cin >> now;
            hs.clear();
        }else if(tp == 2){
            cin >> id >> tnow;
            if(tnow != now)continue;
            if(gs[id] == 1)continue;
            else {
                gs[id] = 1;
                ans[id] += tm;
                tm --;
                hs.pb(id);
            }
        }else if(tp == 3){
            cin >> id >> tnow;
            if(tnow != now)continue;
            if(gs[id] == 1)continue;
            else {
                gs[id] = 1;
                hs.pb(id);
            }
        }
    }

    vector<PII> idx(m + 10);
    for(int i = 1; i <= m; i ++){
        idx[i] = {ans[i], i};
    }
    auto cmp =[&](PII a, PII b){
        if(a.fi != b.fi)return a.fi > b.fi;
        return a.se < b.se;
    };
    sort(idx.begin() + 1, idx.begin() + 1 + m, cmp);
    
    for(int i = 1; i <= m; i ++){
        auto [ans, id] = idx[i];
        cout << id << " " << ans << endl;
    }

}
signed main(){
    ios;
    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: 0ms
memory: 3656kb

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

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

result:

wrong answer 43rd lines differ - expected: '25 25', found: '5 25'