QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#781074#7517. Flying Ship StoryrgnerdplayerRE 0ms0kbC++231.5kb2024-11-25 14:40:372024-11-25 14:40:38

Judging History

你现在查看的是最新测评结果

  • [2024-11-25 14:40:38]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-11-25 14:40:37]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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

output:


result: