QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#699666 | #6770. Ants | jkliao# | WA | 424ms | 28340kb | C++17 | 973b | 2024-11-02 10:19:50 | 2024-11-02 10:19:51 |
Judging History
answer
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
using ll = unsigned 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: 0ms
memory: 3620kb
input:
2 2 4 2 3 0 1
output:
4000000001
result:
ok single line: '4000000001'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
1 1000000000 1000000000 500000000 0
output:
2000000002500000000
result:
ok single line: '2000000002500000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 1000000000 500000000 500000000 1
output:
1000000001500000001
result:
ok single line: '1000000001500000001'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
1 500000000 1000000000 500000000 0
output:
1000000001500000000
result:
ok single line: '1000000001500000000'
Test #5:
score: -100
Wrong Answer
time: 424ms
memory: 28340kb
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'