QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#699783 | #6770. Ants | jkliao# | WA | 0ms | 3852kb | C++17 | 1.0kb | 2024-11-02 10:42:52 | 2024-11-02 10:43:27 |
Judging History
answer
#include <iostream>
#include <set>
#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;
// b = x % n;
a -= (x / n) * (n);
b -= (x / n) * (n);
ll ans = (ll)(x / n) * (2e9 + 1);
vector<ll> pos(n);
for (int i = 0; i < n; i++)
cin >> pos[i];
multiset<pair<ll, int>> pq;
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.begin();
// cout << pp.first << ' ' << pp.second << endl;
pq.erase(pq.begin());
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: 0
Wrong Answer
time: 0ms
memory: 3852kb
input:
2 2 4 2 3 0 1
output:
4000000000
result:
wrong answer 1st lines differ - expected: '4000000001', found: '4000000000'