QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#781072#7517. Flying Ship StoryrgnerdplayerTL 279ms3880kbC++231.5kb2024-11-25 14:40:042024-11-25 14:40:10

Judging History

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

  • [2024-11-25 14:40:10]
  • 评测
  • 测评结果:TL
  • 用时:279ms
  • 内存:3880kb
  • [2024-11-25 14:40:04]
  • 提交

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});
                }
                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: 100
Accepted
time: 0ms
memory: 3880kb

input:

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

output:

2
1
0

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 239ms
memory: 3572kb

input:

1000000
2 370943499 431961772
1 1 1 11995570
2 37566858 838793045
1 11995571 11995569 908148975
2 11995571 11995571
1 1 3 716821068
2 67877937 3
1 11995571 11995571 771898489
2 38381714 99749723
1 915818844 915818847 729541681
2 592361351 915818846
1 783627722 783627722 639375021
2 102203700 8636489...

output:

0
11995570
0
11995570
915818845
783627723
915818845
0
0
915818845
0
783627723
0
904468304
904468304
904468304
915818845
904468304
915818845
904468304
915818845
0
904468304
0
915818845
915818845
0
0
915818845
915818845
0
921710773
0
921710773
998138906
921710773
0
921710773
998138906
0
998138906
0
99...

result:

ok 500000 lines

Test #3:

score: 0
Accepted
time: 279ms
memory: 3624kb

input:

1000000
2 648544745 437316088
1 1 1 221075686
2 802693951 691188141
1 221075687 221075684 1036811136
2 771835961 178451319
1 820061031 820061031 560017372
2 829408420 820061028
1 293604539 293604539 699366423
2 293604539 293604539
1 1 2 610044241
2 50747012 885321059
1 942633132 942633132 603537610
...

output:

0
221075686
820061030
293604538
0
942633133
942633133
27478144
820061030
820061030
900696946
27478144
942633133
942633133
0
772167494
27478144
891145650
900696946
772167494
891145650
918281274
772167494
772167494
772167494
772167494
772167494
942633133
918281274
891145650
918281274
891145650
8911456...

result:

ok 500000 lines

Test #4:

score: -100
Time Limit Exceeded

input:

1000000
2 488777832 43440411
1 441939805 62137297 1349
2 198318033 382339804
1 441938456 72190649 815
2 458351680 72190649
1 441938456 287971850 290
2 161496970 653240491
1 933968337 49827233 1142
2 441938231 49827233
1 623590902 306969890 440
2 441939805 144230480
1 441939265 480404387 11460
2 4419...

output:

0
1349
1349
1642
0
540
440
440
440
11992
4593
4228
9603
4228
12488
7139
4593
14051
14051
14051
16301
4593
20640
14051
34628
20640
34628
35421
34628
34628
49987
11225
17743
11225
17743
35421
17743
35421
17743
49987
56227
56227
11225
11225
56227
56227
56227
56227
56227
37643
37643
49987
37643
37643
21...

result: