QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#403084#4071. Galactic Collegiate Programming ContestQRQRQRWA 68ms4812kbC++17883b2024-05-01 20:32:302024-05-01 20:32:30

Judging History

This is the latest submission verdict.

  • [2024-05-01 20:32:30]
  • Judged
  • Verdict: WA
  • Time: 68ms
  • Memory: 4812kb
  • [2024-05-01 20:32:30]
  • Submitted

answer

#include <bits/stdc++.h>
#include <bits/extc++.h>
#define pii pair<int, int>
#define F first
#define S second
#define ranktree tree<pair<pii, int>, null_type, greater<pair<pii, int>>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

ranktree rt;
int n, m;
pair<pii, int> team[100005];

signed main() {
    //ios::sync_with_stdio(0), cin.tie(0);
    cin >> n >> m;
    for (int i = 0; i < n; i++) team[i].F.F = team[i].F.S = team[i].S =  0;
    for (int i = 0; i < m; i++) {
        int tt, pp;
        cin >> tt >> pp;
        auto it = rt.find(team[tt]);
        if (it != rt.end()) rt.erase(it);
        team[tt].F.F++;
        team[tt].F.S -= pp;
        team[tt].S = -(i+1);
        rt.insert(team[tt]);
        int rk = rt.order_of_key(team[1]);
        cout << rk+1 << "\n";
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 4
2 7
3 5
1 6
1 9

output:

2
3
2
1

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 36ms
memory: 4812kb

input:

100000 100000
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1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
time: 68ms
memory: 4808kb

input:

100000 100000
5 1
1 1
1 1
2 1
1 1
2 1
4 1
4 1
1 1
4 1
1 1
2 1
1 1
2 1
3 1
5 1
1 1
2 1
1 1
1 1
2 1
2 1
1 1
3 1
3 1
5 1
3 1
1 1
2 1
1 1
2 1
5 1
4 1
4 1
4 1
4 1
2 1
2 1
3 1
5 1
2 1
3 1
3 1
3 1
5 1
1 1
3 1
3 1
1 1
3 1
1 1
2 1
5 1
5 1
3 1
4 1
3 1
3 1
2 1
4 1
3 1
2 1
1 1
2 1
1 1
4 1
1 1
3 1
2 1
1 1
4 1
4 ...

output:

2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
...

result:

wrong answer 2nd lines differ - expected: '1', found: '2'