QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#74818#5446. 琪露诺的符卡交换ZhaoZiLong40 697ms63956kbC++142.9kb2023-02-04 09:57:082023-02-04 09:57:11

详细

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 81ms
memory: 59416kb

input:

7
132
96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 ...

output:

8778
1 132 1 132
2 132 1 131
2 131 2 131
3 132 1 130
3 131 2 130
3 130 3 130
4 132 1 129
4 131 2 129
4 130 3 129
4 129 4 129
5 132 1 128
5 131 2 128
5 130 3 128
5 129 4 128
5 128 5 128
6 132 1 127
6 131 2 127
6 130 3 127
6 129 4 127
6 128 5 127
6 127 6 127
7 132 1 126
7 131 2 126
7 130 3 126
7 129 4...

result:

ok your solution is correct.

Test #2:

score: 0
Accepted
time: 33ms
memory: 53212kb

input:

8
14
13 13 13 13 13 13 13 13 13 13 13 13 13 13
7 7 7 7 7 7 7 7 7 7 7 7 7 7
8 8 8 8 8 8 8 8 8 8 8 8 8 8
14 14 14 14 14 14 14 14 14 14 14 14 14 14
5 5 5 5 5 5 5 5 5 5 5 5 5 5
4 4 4 4 4 4 4 4 4 4 4 4 4 4
1 1 1 1 1 1 1 1 1 1 1 1 1 1
10 10 10 10 10 10 10 10 10 10 10 10 10 10
2 2 2 2 2 2 2 2 2 2 2 2 2 2
9...

output:

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

result:

ok your solution is correct.

Test #3:

score: 0
Accepted
time: 49ms
memory: 57448kb

input:

4
82
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1...

output:

3403
1 82 1 82
2 82 1 81
2 81 2 81
3 82 1 80
3 81 2 80
3 80 3 80
4 82 1 79
4 81 2 79
4 80 3 79
4 79 4 79
5 82 1 78
5 81 2 78
5 80 3 78
5 79 4 78
5 78 5 78
6 82 1 77
6 81 2 77
6 80 3 77
6 79 4 77
6 78 5 77
6 77 6 77
7 82 1 76
7 81 2 76
7 80 3 76
7 79 4 76
7 78 5 76
7 77 6 76
7 76 7 76
8 82 1 75
8 81 ...

result:

ok your solution is correct.

Test #4:

score: 0
Accepted
time: 234ms
memory: 59912kb

input:

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

output:

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

result:

ok your solution is correct.

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #5:

score: 20
Accepted
time: 697ms
memory: 61812kb

input:

5
17
9 9 9 9 9 9 9 9 9 9 9 9 9 2 9 9 9
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6
2 2 2 2 2 2 2 2 2 2 2 2 11 2 2 2 2
4 4 4 4 4 4 10 4 4 4 4 4 4 4 4 4 4
10 10 10 10 10 10 8 10 10 10 10 10 10 10 10 10 10
12 12 12 12 12 12 12 12 12 12 12 12 14 12 12 12 12
14 14 14 14 14 14 14 14 14 14 14 12 14 14 14 14 14
16 16...

output:

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

result:

ok your solution is correct.

Test #6:

score: 0
Accepted
time: 356ms
memory: 59448kb

input:

9
1
1
28
2 2 2 2 5 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
7 24 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 8 13 13 13
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 16 8 8 8 8 8 8 8 8 8 8 8 8
17 24 24 24 24 24 24 24 24 24 24 24 24...

output:

1
1 1 1 1
406
1 5 1 5
2 2 1 28
2 28 2 28
3 25 1 27
3 28 2 27
3 27 3 27
4 16 1 26
4 28 2 26
4 27 3 26
4 26 4 26
5 1 1 25
5 28 2 25
5 27 3 24
5 26 4 25
5 25 5 25
6 9 1 24
6 28 2 24
6 27 3 23
6 26 4 24
6 25 5 24
6 24 6 24
7 1 1 23
7 28 2 23
7 27 3 22
7 26 4 23
7 25 5 23
7 24 6 23
7 23 7 23
8 11 1 22
8 ...

result:

ok your solution is correct.

Test #7:

score: 0
Accepted
time: 68ms
memory: 57620kb

input:

9
22
19 19 19 19 19 19 19 19 19 10 19 19 19 19 19 19 19 19 19 19 19 19
17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 8
21 21 21 21 21 21 21 21 5 21 21 21 21 21 21 21 21 21 21 21 21 21
12 12 12 12 12 12 12 22 12 12 12 12 12 12 12 12 12 12 12 12 12 12
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...

output:

253
1 10 1 10
2 22 1 22
2 21 2 21
3 9 1 21
3 22 2 20
3 21 3 21
4 22 1 20
4 21 2 19
4 20 3 20
4 19 4 19
5 21 1 19
5 22 2 18
5 20 3 19
5 19 4 18
5 18 5 18
6 3 1 18
6 22 2 17
6 21 3 18
6 20 4 17
6 19 5 17
6 18 6 18
7 2 1 17
7 22 2 16
7 21 3 17
7 20 4 16
7 19 5 16
7 18 6 17
7 17 7 17
8 22 1 16
8 20 2 15...

result:

ok your solution is correct.

Test #8:

score: 0
Accepted
time: 81ms
memory: 53276kb

input:

8
29
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 6 3 3 3 3
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 3 11 11 11 11 11 11 11 11
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 1 1 1 1 1 1 1
20 20 20 20 20 20 20 20 20 20 20 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
26 26...

output:

435
1 29 1 29
2 29 1 28
2 28 2 28
3 29 1 27
3 28 2 27
3 27 3 27
4 29 1 26
4 28 2 26
4 27 3 26
4 26 4 26
5 29 1 24
5 28 2 25
5 27 3 25
5 26 4 25
5 25 5 25
6 29 1 23
6 28 2 24
6 27 3 24
6 26 4 24
6 25 5 24
6 24 6 24
7 29 1 22
7 28 2 23
7 27 3 23
7 26 4 23
7 25 5 23
7 24 6 23
7 23 7 23
8 29 1 21
8 28 2...

result:

ok your solution is correct.

Subtask #3:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #9:

score: 60
Accepted
time: 4ms
memory: 52992kb

input:

19
1
1
2
1 2
1 2
3
1 3 2
2 3 1
2 1 3
4
1 4 3 4
3 2 2 1
3 1 2 3
4 4 1 2
5
4 2 1 5 4
4 5 4 4 1
5 3 2 3 2
3 1 3 2 1
3 1 2 5 5
6
6 2 2 1 6 6
2 5 5 3 4 6
1 2 4 2 6 1
4 4 1 4 5 1
1 2 6 5 3 5
5 3 3 3 3 4
7
5 2 3 6 4 2 7
2 1 6 1 1 5 2
1 6 7 7 5 1 2
6 6 3 4 4 7 1
3 6 5 7 3 2 7
3 2 5 1 4 5 4
5 3 3 7 4 4 6
8
1...

output:

1
1 1 1 1
3
1 1 1 1
2 2 1 2
2 1 2 1
6
1 1 1 1
2 1 1 2
2 3 2 3
3 3 1 3
3 1 2 2
3 2 3 2
10
1 1 1 1
2 3 1 4
2 2 2 2
3 4 1 3
3 1 2 4
3 3 3 3
4 2 1 2
4 3 2 1
4 1 3 2
4 4 4 4
15
1 3 1 3
2 4 1 4
2 3 2 3
3 5 1 5
3 3 2 5
3 4 3 4
4 3 1 2
4 1 2 1
4 4 3 1
4 5 4 5
5 5 1 1
5 2 2 2
5 4 3 2
5 1 4 2
5 3 5 3
21
1 4 1...

result:

ok your solution is correct.

Test #10:

score: 0
Accepted
time: 8ms
memory: 52904kb

input:

19
1
1
2
2 1
1 2
3
2 1 2
3 3 3
1 2 1
4
1 2 3 4
1 2 3 4
2 3 1 4
4 1 2 3
5
1 2 3 3 3
4 4 1 2 3
5 2 4 5 1
1 4 5 5 2
5 2 1 4 3
6
1 3 6 6 4 4
5 2 4 6 5 2
3 6 5 6 5 2
1 5 1 4 2 4
3 1 6 3 3 2
3 2 1 4 5 1
7
4 4 1 6 6 7 6
3 7 3 4 5 2 7
6 2 7 6 2 1 3
2 2 5 3 1 2 1
7 3 7 4 2 1 4
5 3 6 3 1 5 5
7 5 6 5 1 4 4
8
6...

output:

1
1 1 1 1
3
1 2 1 2
2 2 1 1
2 1 2 1
6
1 2 1 2
2 3 1 3
2 2 2 2
3 2 1 1
3 3 2 1
3 1 3 1
10
1 1 1 1
2 2 1 2
2 1 2 1
3 2 1 3
3 4 2 4
3 3 3 3
4 1 1 4
4 4 2 3
4 3 3 1
4 2 4 2
15
1 1 1 1
2 5 1 5
2 4 2 4
3 2 1 2
3 5 2 3
3 3 3 3
4 2 1 4
4 4 2 2
4 3 3 4
4 1 4 1
5 1 1 3
5 4 2 1
5 5 3 1
5 2 4 5
5 3 5 3
21
1 1 1...

result:

ok your solution is correct.

Test #11:

score: 0
Accepted
time: 7ms
memory: 52928kb

input:

19
1
1
2
2 1
1 2
3
3 3 2
1 1 2
2 1 3
4
4 1 1 3
4 4 1 2
1 2 2 3
3 2 4 3
5
3 1 5 5 5
4 2 2 5 2
1 5 4 3 4
1 1 3 4 4
3 1 2 3 2
6
1 5 5 3 2 1
5 5 2 3 4 3
2 6 2 3 1 4
6 6 6 4 6 1
4 5 1 2 3 4
6 3 2 4 5 1
7
5 1 1 3 3 7 7
5 4 1 4 4 3 6
4 4 2 7 1 3 2
1 3 5 6 5 3 5
6 4 2 7 6 2 3
7 2 6 2 1 6 2
5 7 4 5 7 1 6
8
1...

output:

1
1 1 1 1
3
1 2 1 2
2 2 1 1
2 1 2 1
6
1 2 1 2
2 3 1 3
2 2 2 2
3 2 1 1
3 3 2 1
3 1 3 1
10
1 3 1 3
2 4 1 2
2 2 2 2
3 4 1 1
3 3 2 3
3 2 3 2
4 3 1 4
4 4 2 1
4 1 3 1
4 2 4 2
15
1 2 1 2
2 5 1 5
2 3 2 3
3 2 1 1
3 1 2 4
3 5 3 5
4 5 1 4
4 4 2 2
4 2 3 3
4 3 4 3
5 4 1 3
5 1 2 1
5 5 3 4
5 2 4 1
5 3 5 3
21
1 6 1...

result:

ok your solution is correct.

Test #12:

score: 0
Accepted
time: 8ms
memory: 50796kb

input:

19
1
1
2
2 2
1 1
3
1 1 2
2 1 3
3 2 3
4
2 1 2 3
2 1 3 3
4 4 4 4
2 3 1 1
5
3 5 5 5 4
1 4 4 5 2
1 1 3 1 5
2 4 3 2 3
2 3 4 1 2
6
5 5 4 3 1 1
3 4 1 6 6 6
6 2 2 1 4 4
2 2 6 5 3 3
1 5 6 2 3 3
5 4 1 2 4 5
7
6 4 4 7 7 5 6
1 1 2 1 4 2 7
5 2 5 3 1 1 2
3 4 2 7 6 7 6
5 6 1 2 7 6 4
5 6 5 3 3 7 3
5 4 2 1 3 4 3
8
2...

output:

1
1 1 1 1
3
1 2 1 2
2 2 1 1
2 1 2 1
6
1 2 1 2
2 1 1 3
2 2 2 2
3 3 1 1
3 1 2 3
3 2 3 2
10
1 2 1 2
2 1 1 4
2 2 2 2
3 4 1 3
3 3 2 4
3 2 3 2
4 2 1 1
4 1 2 3
4 4 3 1
4 3 4 3
15
1 4 1 4
2 5 1 5
2 1 2 1
3 4 1 1
3 5 2 4
3 2 3 2
4 5 1 3
4 4 2 3
4 2 3 1
4 3 4 3
5 3 1 2
5 2 2 2
5 5 3 3
5 1 4 1
5 4 5 4
21
1 2 1...

result:

ok your solution is correct.

Test #13:

score: 0
Accepted
time: 406ms
memory: 63956kb

input:

5
156
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 95 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 34 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 17 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 130 1 42 1 1 1 1 1 1 1 1 1 1 1 1 90 1 64 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

12246
1 156 1 156
2 156 1 155
2 155 2 155
3 156 1 154
3 155 2 154
3 154 3 154
4 156 1 153
4 155 2 153
4 154 3 153
4 153 4 153
5 155 1 152
5 154 2 152
5 153 3 152
5 152 4 152
5 151 5 151
6 156 1 151
6 155 2 151
6 154 3 151
6 153 4 150
6 152 5 150
6 151 6 151
7 155 1 150
7 154 2 150
7 153 3 150
7 151 ...

result:

ok your solution is correct.

Test #14:

score: 0
Accepted
time: 194ms
memory: 57596kb

input:

7
2
1 2
1 2
4
1 4 4 1
2 3 2 4
1 4 3 3
3 1 2 2
39
1 31 38 1 22 35 1 32 36 19 33 1 1 1 4 14 24 35 33 4 1 31 34 1 1 27 1 1 34 8 35 1 1 38 10 1 6 8 10
22 14 2 2 2 20 9 26 2 8 26 23 2 36 36 2 38 2 2 18 27 29 3 28 2 3 31 33 36 2 20 2 11 33 32 2 2 2 32
34 39 11 34 35 3 3 3 16 3 3 3 34 39 3 27 17 30 33 11 3...

output:

3
1 1 1 1
2 2 1 2
2 1 2 1
10
1 4 1 4
2 3 1 1
2 4 2 4
3 2 1 3
3 4 2 2
3 1 3 1
4 1 1 2
4 4 2 1
4 3 3 3
4 2 4 2
780
1 36 1 36
2 38 1 33
2 37 2 37
3 36 1 32
3 30 2 36
3 24 3 24
4 39 1 28
4 38 2 32
4 37 3 21
4 31 4 31
5 37 1 27
5 36 2 30
5 35 3 15
5 34 4 23
5 32 5 32
6 36 1 25
6 35 2 25
6 29 3 12
6 20 4 ...

result:

ok your solution is correct.

Test #15:

score: 0
Accepted
time: 449ms
memory: 59324kb

input:

7
9
3 8 8 5 7 7 2 5 2
5 9 4 9 8 3 5 7 5
1 2 6 6 9 3 9 6 4
7 6 9 1 7 7 1 4 7
2 7 6 3 8 1 2 9 8
3 8 2 2 4 6 1 6 1
1 5 2 6 4 8 4 6 4
9 3 3 9 9 1 3 7 8
4 1 4 8 5 5 3 2 5
8
8 4 7 2 1 7 3 2
2 2 8 7 6 3 5 6
8 8 1 7 5 8 1 5
2 8 5 1 7 3 1 2
4 1 3 6 6 3 7 8
4 2 3 6 1 5 5 2
4 7 4 3 7 4 6 3
6 6 5 1 5 4 8 4
2
1 ...

output:

45
1 9 1 9
2 9 1 7
2 4 2 4
3 6 1 1
3 9 2 3
3 1 3 1
4 7 1 3
4 9 2 6
4 6 3 2
4 5 4 5
5 2 1 6
5 4 2 2
5 7 3 8
5 6 4 4
5 1 5 1
6 5 1 8
6 8 2 5
6 2 3 4
6 6 4 1
6 1 5 8
6 9 6 9
7 8 1 5
7 6 2 7
7 4 3 3
7 9 4 3
7 2 5 9
7 3 6 4
7 7 7 7
8 5 1 2
8 6 2 1
8 4 3 7
8 1 4 8
8 9 5 3
8 7 6 3
8 3 7 1
8 8 8 8
9 4 1 4
9...

result:

ok your solution is correct.

Test #16:

score: 0
Accepted
time: 153ms
memory: 59376kb

input:

9
8
8 7 6 6 2 2 6 2
5 1 6 5 5 4 1 2
5 3 8 1 2 2 4 3
5 4 7 8 7 1 7 1
6 4 8 4 1 6 8 3
3 3 1 8 3 5 4 3
7 6 5 2 7 3 6 8
8 4 7 2 1 7 5 4
6
3 3 6 2 5 2
5 5 4 4 6 1
6 4 1 3 2 4
3 5 3 6 3 1
4 2 2 1 6 5
1 6 5 4 1 2
118
1 18 1 1 1 1 1 1 4 1 115 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 18 62 1 1 1 1 1 1 1...

output:

36
1 1 1 1
2 8 1 8
2 7 2 7
3 8 1 6
3 2 2 3
3 1 3 1
4 2 1 7
4 1 2 5
4 8 3 6
4 6 4 6
5 6 1 5
5 1 2 2
5 4 3 7
5 2 4 7
5 7 5 7
6 6 1 2
6 7 2 4
6 8 3 5
6 4 4 4
6 5 5 5
6 2 6 2
7 5 1 4
7 1 2 1
7 8 3 4
7 6 4 5
7 7 5 3
7 2 6 1
7 4 7 4
8 5 1 3
8 1 2 6
8 6 3 3
8 3 4 3
8 7 5 8
8 8 6 3
8 2 7 3
8 4 8 4
21
1 6 1 ...

result:

ok your solution is correct.

Test #17:

score: -60
Time Limit Exceeded

input:

1
200
10 98 86 3 124 117 19 6 74 143 48 196 32 33 15 5 23 56 138 65 150 46 125 157 43 162 48 141 161 93 179 175 163 1 144 183 105 65 158 195 102 112 69 194 142 177 182 135 60 77 140 117 47 171 5 157 14 115 17 163 130 55 134 74 10 108 117 181 75 154 14 138 106 60 127 25 162 196 172 156 66 41 20 127 1...

output:


result: