QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#403849 | #8302. Incoming Asteroids | james1BadCreeper | WA | 152ms | 46048kb | C++14 | 1.8kb | 2024-05-02 19:37:03 | 2024-05-02 19:37:04 |
Judging History
answer
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long i64;
const int N = 3e5 + 5;
int n, q, id, arr[N];
i64 a[N];
set<pair<i64, int>> st[N];
vector<pair<int, pair<i64, i64>>> loc[N];
int main(void) {
ios::sync_with_stdio(0);
cin >> n >> q;
for (int lst = 0; q--; ) {
int op; cin >> op;
if (op == 1) {
int y, k; cin >> y >> k; y ^= lst; arr[id++] = y; // 报警限制
while (k--) {
int v; cin >> v; v ^= lst;
st[v].emplace((y + 2) / 3 + a[v], id);
loc[id].push_back({v, {(y + 2) / 3 + a[v], a[v]}});
}
} else {
int x, y; cin >> x >> y; x ^= lst; y ^= lst;
int cnt = 0; a[x] += y;
vector<int> ans;
while (st[x].size()) {
auto p = *st[x].begin();
if (p.fi > a[x]) break;
int idx = p.se; // 检查这一条报警
vector<int> vec;
for (auto nxt : loc[idx]) {
arr[idx] -= a[nxt.fi] - nxt.se.se;
st[nxt.fi].erase({nxt.se.fi, idx});
vec.push_back(nxt.fi);
}
if (arr[idx] <= 0) { ans.push_back(idx); continue; }
loc[idx].clear();
int v = (arr[idx] + 2) / 3;
for (int nxt : vec) {
st[nxt].emplace(v + a[nxt], idx);
loc[idx].push_back({nxt, {v + a[nxt], a[nxt]}});
}
}
lst = ans.size(); sort(ans.begin(), ans.end());
cout << ans.size();
for (int i : ans) cout << " " << i;
cout << "\n";
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 24800kb
input:
3 5 1 5 3 1 2 3 2 2 1 1 2 2 1 2 2 3 1 2 1 3
output:
0 0 2 1 2
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 152ms
memory: 46048kb
input:
200000 200000 1 421386 1 122023 2 127573 97972 1 489180 1 197930 2 82505 59100 1 502097 3 91617 14193 139642 2 132931 74031 1 404862 1 36227 2 152826 8462 1 750072 2 51616 75416 2 1547 11479 1 255849 2 70036 41620 2 126414 17120 1 626334 3 97273 190595 174083 2 148803 132 1 407236 2 83898 5103 2 169...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 258th lines differ - expected: '1 88', found: '0'