QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#794875#9544. Grand Prix of BallanceP-BaoWA 1ms3624kbC++231.7kb2024-11-30 16:37:032024-11-30 16:37:04

Judging History

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

  • [2024-11-30 16:37:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3624kb
  • [2024-11-30 16:37:03]
  • 提交

answer

#include <bits/stdc++.h>

#define ll long long
#define mod 1000000007

using namespace std;

ll point[100005];
bool cmp(pair<int , int> a, pair<int , int> b){
    if(a.first == b.first){
        return a.second < b.second;
    }
    return a.first > b.first;
}
void solve(){
    int n,m , q;
    cin >> n >> m >> q;
    vector<int> cur;
    set<int> st;
    int round = 0;
    for(int i = 1; i <=m ; i++){
        point[i] = 0;
    }
    for(int i =1; i <= q; i++){
        int type;
        cin >> type;
        if(type == 1){
            int x;
            cin >> x;
            round = x;
            st.clear();
            cur.clear();
        }
        else if(type == 2){
            int id;
            int val;
            cin >>id>> val;
            if(val != round){
                continue;
            }
            else{
                auto find = st.find(id);
                if(find == st.end()){
                    st.insert(id);
                    
                    point[id] += m - cur.size();
                    cur.push_back(id);
                }

            }
            

        }
        else{
            int id;
            int val;
            cin >>id>> val;
            st.insert(id);
        }
    }
    vector<pair<int , int>> ans;
    for(int i = 1; i <= m; i++){
        ans.push_back({point[i], i});
    }
    sort(ans.begin(), ans.end(), cmp);
    for(int i = 0; i < ans.size(); i++){
        cout << ans[i].second << " " <<ans[i].first << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin >> t;
    while(t--){
        solve();
    }

    return 0;
}

詳細信息

Test #1:

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

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: 1ms
memory: 3624kb

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

result:

wrong answer 9th lines differ - expected: '3 7', found: '7 7'