QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#781074 | #7517. Flying Ship Story | rgnerdplayer | RE | 0ms | 0kb | C++23 | 1.5kb | 2024-11-25 14:40:37 | 2024-11-25 14:40:38 |
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
auto solve = [&]() {
int q;
cin >> q;
int lst = 0;
vector<array<int, 3>> v;
while (q--) {
int op, x, y;
cin >> op >> x >> y;
x ^= lst, y ^= lst;
if (op == 1) {
int w;
cin >> w;
w ^= lst;
v.push_back({w, x, y});
sort(v.rbegin(), v.rend());
vector<array<int, 3>> newv(4);
for (auto [c, a, b] : v) {
int c12 = 0, c1 = 0, c2 = 0;
for (auto [c2, a2, b2] : newv) {
c12 += a == a2 && b == b2;
c1 += a == a2;
c2 += b == b2;
}
if (c12 >= 1 || c1 >= 2 || c2 >= 2) {
continue;
}
newv.push_back({c, a, b});
}
assert(newv.size() <= 4);
v = move(newv);
} else {
int ans = 0;
for (auto [c, a, b] : v) {
if (x != a && y != b) {
ans = max(ans, c);
}
}
cout << (lst = ans) << '\n';
}
}
};
solve();
return 0;
}
詳細信息
Test #1:
score: 0
Runtime Error
input:
5 1 2 3 1 1 4 5 2 2 2 2 2 3 7 2 3 4