QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#699837 | #6770. Ants | jkliao | WA | 0ms | 3828kb | C++17 | 1.0kb | 2024-11-02 10:53:35 | 2024-11-02 10:53:35 |
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 + 2);
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3828kb
input:
2 2 4 2 3 0 1
output:
3000000000
result:
wrong answer 1st lines differ - expected: '4000000001', found: '3000000000'