QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#403856 | #8302. Incoming Asteroids | james1BadCreeper | WA | 132ms | 47192kb | C++14 | 1.8kb | 2024-05-02 19:39:01 | 2024-05-02 19:39:02 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
using namespace std;
typedef long long i64;
const int N = 3e5 + 5;
int n, q, id;
i64 a[N], arr[N];
set<pair<i64, int>> st[N];
vector<pair<int, pair<i64, i64>>> loc[N];
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;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 26724kb
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: 132ms
memory: 47192kb
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'