QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#699658#6770. Antsjkliao#WA 423ms29008kbC++17964b2024-11-02 10:17:252024-11-02 10:17:35

Judging History

This is the latest submission verdict.

  • [2024-11-02 10:17:35]
  • Judged
  • Verdict: WA
  • Time: 423ms
  • Memory: 29008kb
  • [2024-11-02 10:17:25]
  • Submitted

answer

#include <iostream>
#include <queue>
#include <vector>
using namespace std;

using ll = long long;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int x = min(a, b);
  a -= x / n * n;
  b -= x / n * n;
  ll ans = (ll)(x / n) * (2e9 + 2);
  vector<ll> pos(n);
  for (int i = 0; i < n; i++)
    cin >> pos[i];
  priority_queue<pair<ll, bool>> pq; // 0 is a, 1 is b
  for (int i = 0; i < n; i++) {
    int d;
    cin >> d;
    if (d == 0) {
      pq.emplace(pos[i], 0);
    } else {
      pq.emplace(1e9 + 1 - pos[i], 1);
    }
  }
  ll finishtime = 0;
  while (!pq.empty()) {
    auto pp = pq.top();
    pq.pop();
    finishtime = max(finishtime, pp.first);
    if (pp.second == 0) {
      if (a != 0) {
        a--;
        pq.emplace(pp.first + (1e9 + 1), 1);
      }
    } else {
      if (b != 0) {
        b--;
        pq.emplace(pp.first + (1e9 + 1), 0);
      }
    }
  }
  cout << finishtime + ans << endl;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3556kb

input:

2 2 4
2 3
0 1

output:

4000000001

result:

ok single line: '4000000001'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

1 1000000000 1000000000
500000000
0

output:

2000000002500000000

result:

ok single line: '2000000002500000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

1 1000000000 500000000
500000000
1

output:

1000000001500000001

result:

ok single line: '1000000001500000001'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

1 500000000 1000000000
500000000
0

output:

1000000001500000000

result:

ok single line: '1000000001500000000'

Test #5:

score: -100
Wrong Answer
time: 423ms
memory: 29008kb

input:

999963 1000000000 1000000000
516 793 2609 2721 3010 3378 4494 6294 7719 9298 9582 10021 10255 13552 16357 16771 16864 18824 19006 19162 19583 22099 22970 23637 25760 26962 29349 31140 34093 34398 35622 35765 35868 35899 36213 37137 38062 43181 43361 44347 46328 48145 48188 49187 50303 50873 52999 53...

output:

76001000075485

result:

wrong answer 1st lines differ - expected: '2001074431727', found: '76001000075485'