QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#418976#5533. Tricktotest29 6ms3960kbC++14852b2024-05-23 16:45:582024-05-23 16:45:58

Judging History

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

  • [2024-05-23 16:45:58]
  • 评测
  • 测评结果:29
  • 用时:6ms
  • 内存:3960kb
  • [2024-05-23 16:45:58]
  • 提交

answer

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

const int mxN=1234567;
int t, r, n, m;
bool a[2*mxN+1];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> t >> r;
	while(t--) {
		cin >> n, m=2*n+1;
		vector<array<int, 2>> p{{0, 2*n}, {0, 1}, {2*n-1, n}, {2, n}, {n+1, 4}, {n+1, 2*n-3}};
		for(int i=1; i<n; ++i)
			p.push_back({i, m-i});
		if(r^3) {
			memset(a, 0, m);
			long long s=0;
			for(int i=0, b; i<n; ++i)
				cin >> b, s+=b, a[b]=1;
			for(array<int, 2> c : p) {
				if(a[(c[0]+s)%m]&&a[(c[1]+s)%m]) {
					cout << (c[0]+s)%m << " " << (c[1]+s)%m << "\n";
					break;
				}
			}
		} else {
			int s=0;
			for(int i=0, b0, b1; i<2; ++i) {
				cin >> b0 >> b1;
				for(array<int, 2> c : p)
					if((b0-c[0]+m)%m==(b1-c[1]+m)%m)
						s+=b0-c[0]+m;
			}
			cout << (4*m-s)%m << "\n";
		}
	}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 29
Accepted

Test #1:

score: 29
Accepted
time: 5ms = 0ms + 5ms
memory: 0kb,3920kb

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:

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

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 11
6 10
10 7
6 11
12 7
7 9
6 8
7 11
5 9
9 11
12 7
7 9
10 5
11 10
7 11
4 8
12 7
7 4
12 11
9 4
10 9
7 11
8 10
7 9
12 11
11 12
10 9
9 8
7 11
2 11
12 11
11 10
11 9
9 8
8 7
7 11
12 11
11 10
10 11
9 8
8 7
7 8
7 11
11 10
10 9
10 8
8 7
7 8
0 10
6 10
5 9
5 10
11 6
12 11
12 10
10 9
6 10
4 8
11 6
12 11
11 12...

input:

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

output:

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

result:

ok very good job! (12012 test cases)

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 6ms = 0ms + 6ms
memory: 0kb,3944kb

input:

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

output:

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

input:

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

output:

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

input:

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

output:

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

result:

wrong answer the card you returned is -12, but expected 2 (test case 11)

Subtask #3:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 6ms = 0ms + 6ms
memory: 0kb,3960kb

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:

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

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:

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

input:

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

output:

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

result:

wrong answer the card you returned is -14, but expected 14 (test case 11)

Subtask #4:

score: 0
Skipped