QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#781519#7517. Flying Ship StoryrgnerdplayerWA 0ms3572kbC++231.8kb2024-11-25 16:20:052024-11-25 16:20:17

Judging History

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

  • [2024-11-25 16:20:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3572kb
  • [2024-11-25 16:20:05]
  • 提交

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;
            cout << "real: " << x << ' ' << y << ' ';
            if (op == 1) {
                int w;
                cin >> w;
                w ^= lst;
                cout << w << '\n';
                v.push_back({w, x, y});
                sort(v.rbegin(), v.rend());
                vector<array<int, 3>> newv;
                for (auto [c, a, b] : v) {
                    array<int, 4> cnt{};
                    for (auto [c2, a2, b2] : newv) {
                        cnt[(a == a2) + (b == b2) * 2]++;
                    }
                    if (cnt[3] >= 1 || cnt[1] >= 2 || cnt[2] >= 2) {
                        continue;
                    }
                    newv.push_back({c, a, b});
                }
                if (newv.size() > 5) {
                    newv.resize(4);
                }
                v = move(newv);
            } else {
                int ans = 0;
                for (auto [c, a, b] : v) {
                    if (x != a && y != b) {
                        ans = max(ans, c);
                    }
                }
                cout << "ans: " << (lst = ans) << '\n';
            }
            cout << "vector:\n";
            for (auto [c, a, b] : v) {
                cout << c << ' ' << a << ' ' << b << '\n';
            }
            cout << "-------------------\n";
        }
    };
    
    solve();
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3572kb

input:

5
1 2 3 1
1 4 5 2
2 2 2
2 3 7
2 3 4

output:

real: 2 3 1
vector:
1 2 3
-------------------
real: 4 5 2
vector:
2 4 5
1 2 3
-------------------
real: 2 2 ans: 2
vector:
2 4 5
1 2 3
-------------------
real: 1 5 ans: 1
vector:
2 4 5
1 2 3
-------------------
real: 2 5 ans: 0
vector:
2 4 5
1 2 3
-------------------

result:

wrong answer 1st lines differ - expected: '2', found: 'real: 2 3 1'