QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#318686#5533. Trickminhnhatnoe0 25ms3752kbC++141.7kb2024-01-31 17:01:282024-01-31 17:01:28

Judging History

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

  • [2024-01-31 17:01:28]
  • 评测
  • 测评结果:0
  • 用时:25ms
  • 内存:3752kb
  • [2024-01-31 17:01:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

vector<int> gperm(int n){
    vector<int> p(2*n+1); iota(p.begin(), p.end(), 0);
    shuffle(p.begin(), p.end(), mt19937(24032006));
    return p;
}
struct cplayer{
    cplayer(){
        int n; cin >> n;
        vector<int> p = gperm(n);
        vector<int> a(n), b(n);
        vector<pair<int, int>> b_sorted(n);
        for (int i=0; i<n; i++){
            cin >> a[i];
            b[i] = p[a[i]];
            b_sorted[i] = {b[i], i};
        }
        sort(b_sorted.begin(), b_sorted.end());

        int x = 0;
        for (int i=0; i<p.size(); i++) x ^= p[i];
        for (int i=0; i<n; i++) x = x ^ b[i];

        for (int i=0; i<n; i++){
            int y = x ^ b[i];
            auto it = lower_bound(b_sorted.begin(), b_sorted.end(), pair<int, int> (y, -1));
            if (it == b_sorted.end() || it->first != y || it->second == i) continue;
            cout << a[i] << " " << a[it->second] << "\n";
            return;
        }
    }
};

struct hplayer{
    hplayer(){
        int n; cin >> n;
        vector<int> p = gperm(n);
        
        int x = 0;
        for (int i=0; i<p.size(); i++) x ^= p[i];
        for (int i=0; i<4; i++){
            int v; cin >> v; x ^= p[v];
        }
        cout << find(p.begin(), p.end(), x) - p.begin() << "\n";
    }
};
signed main(){
    cin.tie(0)->sync_with_stdio(0);
    // freopen("trick.in", "r", stdin);
    // freopen("trick.out", "w", stdout);

    int t, r; cin >> t >> r;
    if (r == 1 || r == 2){
        for (int i=0; i<t; i++){
            cplayer();
        }
    }
    else{
        for (int i=0; i<t; i++){
            hplayer();
        }
    }
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 25ms = 0ms + 25ms
memory: 0kb,3752kb

input:

12012
1
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 5 6
6
0 1 2 3 5 6
6
0 1 2 3 5 6
6
0 1 2 3 5 6
6
0 1 2 3 5 6
6
0 1 2 3 5 6
6
0 1 2 3 5 ...

output:

1 2
1 2
1 2
1 2
1 2
1 2
1 2
0 1
0 1
0 1
0 1
0 1
0 1
0 1
1 5
1 5
1 5
1 5
1 5
1 5
1 5
0 3
0 3
0 3
0 3
0 3
0 3
0 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
0 1
0 1
0 1
0 1
0 1
0 1
0 1
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
0 5
0 5
0 5
0 5
0 5
0 5
0 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 7
1 7
1 7
1 7
1 7
...

input:

12012
2
6
7 8 9 10 11 12
6
6 8 9 10 11 12
6
6 7 9 10 11 12
6
6 7 8 10 11 12
6
6 7 8 9 11 12
6
6 7 8 9 10 12
6
6 7 8 9 10 11
6
7 8 9 10 11 12
6
5 8 9 10 11 12
6
5 7 9 10 11 12
6
5 7 8 10 11 12
6
5 7 8 9 11 12
6
5 7 8 9 10 12
6
5 7 8 9 10 11
6
7 8 9 10 11 12
6
4 8 9 10 11 12
6
4 7 9 10 11 12
6
4 7 8 1...

output:

7 8
6 8
6 7
7 12
6 11
6 10
7 9
7 8
5 8
5 7
7 11
5 11
5 10
7 8
4 8
4 7
8 12
4 11
4 10
8 9
7 8
3 8
3 7
3 11
3 10
7 10
7 8
2 8
2 7
2 11
2 10
7 11
7 8
1 8
1 7
1 11
1 10
7 8
0 8
0 7
7 10
0 11
0 10
6 8
5 8
5 6
5 12
6 9
5 9
6 8
4 8
4 6
4 12
8 11
8 10
4 9
6 8
3 8
3 6
3 12
6 12
3 9
6 8
2 8
2 6
2 12
6 12
2 9
...

input:

12012
3
6
1 2 7 8
6
1 2 6 8
6
1 2 6 7
6
1 2 7 12
6
1 2 6 11
6
1 2 6 10
6
1 2 7 9
6
0 1 7 8
6
0 1 5 8
6
0 1 5 7
6
0 1 7 11
6
0 1 5 11
6
0 1 5 10
6
0 1 7 8
6
1 5 4 8
6
1 5 4 7
6
1 5 8 12
6
1 5 4 11
6
1 5 4 10
6
1 5 8 9
6
1 5 7 8
6
0 3 3 8
6
0 3 3 7
6
0 3 3 11
6
0 3 3 10
6
0 3 7 10
6
0 3 7 8
6
0 3 2 8
...

output:

5
3
2
13
13
12
11
3
6
4
13
13
13
3
5
0
10
9
1
13
2
13
13
4
6
5
1
13
4
13
13
1
0
10
11
4
6
3
4
6
12
13
10
3
7
4
13
13
1
2
3
0
10
9
1
13
1
11
13
2
4
5
1
7
4
13
13
1
0
13
1
7
5
0
4
8
3
12
6
3
8
1
13
12
13
13
12
11
0
2
6
12
13
13
9
0
3
4
5
8
2
12
3
4
13
4
2
3
4
13
13
13
11
9
13
4
2
3
7
13
12
1
7
5
0
4
0...

result:

wrong answer the card you returned is 5, but expected 6 (test case 1)

Subtask #2:

score: 0
Skipped

Subtask #3:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 19ms = 0ms + 19ms
memory: 0kb,3640kb

input:

6525
1
6
10 1 11 3 12 6
6
1 7 10 12 5 6
6
0 10 12 7 9 8
6
12 1 8 4 7 11
6
11 8 9 4 10 6
6
0 7 2 3 4 5
6
0 8 3 10 11 6
6
0 1 2 4 7 6
6
0 1 11 9 5 6
6
7 1 12 8 6 5
7
0 1 13 10 12 5 6
7
0 14 2 3 4 12 6
7
11 1 3 8 12 6 13
7
0 1 2 3 13 5 14
7
11 9 10 8 4 14 7
7
0 8 14 3 4 13 11
7
0 10 2 14 8 5 6
7
0 13 2...

output:

10 1
0 10
9 4
0 5
0 3
0 9
0 1
11 3
1 14
4 7
0 4
3 14
10 11
0 14
1 2
9 12
12 8
1 16
0 3
17 10
14 8
13 9
0 4
0 2
17 16
3 13
1 3
5 12
0 10
20 5
7 19
0 13
16 6
18 10
17 9
21 2
0 22
18 16
11 14
0 13
14 22
21 11
5 10
0 4
3 6
1 21
4 10
15 19
0 11
17 12
2 3
1 11
13 9
4 10
11 3
15 21
0 17
4 19
0 10
15 8
0 17...

input:

6525
2
6
0 2 4 5 8 9
6
2 3 4 8 9 11
6
1 2 3 4 5 11
6
0 3 5 6 9 10
6
0 1 3 5 7 12
6
1 6 8 10 11 12
6
2 4 5 7 9 12
6
5 8 9 10 11 12
6
3 4 7 8 10 12
6
0 2 3 4 9 11
7
2 3 4 7 8 9 11
7
1 5 7 8 9 10 13
7
0 4 5 7 9 10 14
7
4 6 7 8 9 10 11
7
0 1 2 3 5 6 13
7
1 2 5 7 9 10 12
7
1 3 4 9 11 12 13
7
1 3 4 6 10 1...

output:

2 4
0 3
1 12
5 8
7 8
1 10
0 13
10 12
1 3
3 12
4 9
3 11
9 11
2 14
5 7
11 14
7 14
4 12
2 7
1 18
13 15
4 14
6 8
5 15
16 17
1 17
4 16
8 13
3 14
12 18
1 20
1 18
0 11
6 13
5 14
2 5
18 21
3 22
0 15
5 18
3 11
11 16
7 14
8 20
14 17
6 21
7 16
6 17
1 7
4 21
4 16
3 16
0 12
5 19
7 20
1 3
0 10
7 10
2 9
0 1
1 21
2...

input:

6525
3
6
10 1 2 4
6
0 10 0 3
6
9 4 1 12
6
0 5 5 8
6
0 3 7 8
6
0 9 1 10
6
0 1 0 13
6
11 3 10 12
6
1 14 1 3
6
4 7 3 12
7
0 4 4 9
7
3 14 3 11
7
10 11 9 11
7
0 14 2 14
7
1 2 5 7
7
9 12 11 14
7
12 8 7 14
7
1 16 4 12
7
0 3 2 7
7
17 10 1 18
8
14 8 13 15
8
13 9 4 14
8
0 4 6 8
8
0 2 5 15
8
17 16 16 17
8
3 13...

output:

13
8
6
13
1
4
12
2
13
0
13
0
12
7
9
3
13
14
3
15
4
10
17
17
13
3
17
6
17
17
19
15
19
19
15
19
19
19
16
9
21
18
19
10
0
21
21
18
14
21
15
9
20
23
23
8
11
23
17
23
8
8
23
4
14
18
8
1
3
18
23
18
23
13
23
13
19
20
3
18
5
14
17
21
22
3
9
3
3
21
17
23
22
23
6
9
5
23
0
7
18
9
14
19
1
15
2
5
5
15
0
15
8
22
...

result:

wrong answer the card you returned is 13, but expected 7 (test case 1)

Subtask #4:

score: 0
Skipped