QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#782409#9544. Grand Prix of BallancewxhtzdyWA 0ms3592kbC++141.3kb2024-11-25 20:00:112024-11-25 20:00:15

Judging History

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

  • [2024-11-25 20:00:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3592kb
  • [2024-11-25 20:00:11]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    int n, m, q;
    cin >> m >> n >> q;
    int cur = -1;
    vector<int64_t> a(n);
    vector<bool> done(n);
    vector<int> ids;
    int p;
    while (q--) {
      int op;
      cin >> op;
      if (op == 1) {
        int level;
        cin >> level;
        cur = level;
        for (int i : ids) {
          done[i] = false;
        }
        ids.clear();
        p = m;
      }
      if (op == 2) {
        int id, x;
        cin >> id >> x;
        --id;
        if (done[id] || cur != x) {
          continue;
        }
        a[id] += p;
        p -= 1;
        done[id] = true;
        ids.push_back(id);
      }
      if (op == 3) {
        int id, x;
        cin >> id >> x;
        --id;
        if (done[id] || cur != x) {
          continue;
        }
        done[id] = true;
        ids.push_back(id);
      }
    }
    vector<int> order(n);
    iota(order.begin(), order.end(), 0);
    sort(order.begin(), order.end(), [&](int i, int j) {
      if (a[i] != a[j]) {
        return a[i] > a[j];
      } else {
        return i < j;
      }
    });
    for (int i : order) {
      cout << i + 1 << " " << a[i] << '\n';
    }
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3592kb

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

result:

wrong answer 1st lines differ - expected: '2 4', found: '2 3'