QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#517408#1668. GuideZhaoZiLongAC ✓79ms44224kbC++202.7kb2024-08-13 11:17:112024-08-13 11:17:11

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 16268kb

input:

3
6 2
1 1 2 2 3
6 6
1 1 2 2 3
6 4
1 2 3 4 5

output:

1
1 2 
8
1 2 5 2 4 2 1 3 6 
3
1 2 3 4 

result:

ok All testcases are passed!

Test #2:

score: 0
Accepted
time: 2ms
memory: 15784kb

input:

3
1 1

2 1
1
2 2
1

output:

0
1 
0
1 
1
1 2 

result:

ok All testcases are passed!

Test #3:

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

input:

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

output:

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

result:

ok All testcases are passed!

Test #4:

score: 0
Accepted
time: 72ms
memory: 29292kb

input:

100
100 1
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50
100 2
1 1 2...

output:

0
1 
1
1 2 
2
1 2 4 
3
1 2 4 8 
4
1 2 4 8 16 
5
1 2 4 8 16 32 
6
1 2 4 8 16 32 64 
8
1 2 4 8 16 32 64 32 65 
10
1 2 4 8 16 32 16 33 66 33 67 
12
1 2 4 8 16 32 64 32 16 33 66 33 67 
14
1 2 4 8 16 32 65 32 64 32 16 33 66 33 67 
16
1 2 4 8 16 8 17 34 69 34 68 34 17 35 70 35 71 
18
1 2 4 8 16 32 16 8 17...

result:

ok All testcases are passed!

Test #5:

score: 0
Accepted
time: 75ms
memory: 43952kb

input:

100
100 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
10...

output:

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

result:

ok All testcases are passed!

Test #6:

score: 0
Accepted
time: 70ms
memory: 43072kb

input:

100
100 1
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 61 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 99
100...

output:

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

result:

ok All testcases are passed!

Test #7:

score: 0
Accepted
time: 65ms
memory: 14336kb

input:

100
100 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
100 2
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 1 1 1 1 1 ...

output:

0
1 
1
1 2 
3
1 2 1 3 
5
1 3 1 2 1 4 
7
1 4 1 3 1 2 1 5 
9
1 5 1 4 1 3 1 2 1 6 
11
1 6 1 5 1 4 1 3 1 2 1 7 
13
1 7 1 6 1 5 1 4 1 3 1 2 1 8 
15
1 8 1 7 1 6 1 5 1 4 1 3 1 2 1 9 
17
1 9 1 8 1 7 1 6 1 5 1 4 1 3 1 2 1 10 
19
1 10 1 9 1 8 1 7 1 6 1 5 1 4 1 3 1 2 1 11 
21
1 11 1 10 1 9 1 8 1 7 1 6 1 5 1 4 ...

result:

ok All testcases are passed!

Test #8:

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

input:

100
100 1
1 2 2 1 3 3 5 4 3 1 5 3 4 2 14 9 10 8 11 16 7 6 6 5 5 24 23 6 28 30 11 24 8 2 19 26 29 37 23 33 19 37 19 44 30 19 44 44 40 37 22 41 44 26 31 53 8 51 15 3 17 47 63 21 8 62 43 9 49 38 48 49 34 47 44 29 66 1 39 26 16 31 72 41 48 77 8 74 8 67 12 2 24 75 91 36 8 23 69
100 2
1 2 2 1 3 3 5 4 3 1 ...

output:

0
1 
1
1 2 
2
1 2 3 
3
1 2 3 6 
4
1 2 3 6 23 
5
1 2 3 6 23 28 
6
1 2 3 6 23 28 30 
7
1 2 3 6 23 28 30 31 
8
1 2 3 6 23 28 30 31 56 
10
1 2 3 6 23 28 30 31 56 31 83 
12
1 2 3 6 23 28 30 46 30 31 56 31 83 
14
1 2 3 6 23 40 50 40 23 28 30 31 56 31 83 
16
1 2 3 6 23 40 50 40 23 28 30 46 30 31 56 31 83 
...

result:

ok All testcases are passed!

Test #9:

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

input:

100
100 1
1 1 2 4 5 4 2 8 8 4 9 11 9 5 6 2 2 3 6 5 8 1 23 5 2 15 13 13 17 8 15 24 13 25 6 3 9 22 34 32 23 39 7 39 30 44 28 36 16 34 50 45 48 2 14 23 21 37 57 39 9 14 20 42 10 22 12 49 34 40 17 69 48 74 15 8 47 14 39 43 1 60 50 3 5 32 87 79 68 7 2 65 27 67 72 26 29 86 59
100 2
1 1 2 4 5 4 2 8 8 4 9 1...

output:

0
1 
1
1 2 
2
1 2 4 
3
1 2 4 5 
4
1 2 4 5 6 
5
1 2 4 5 6 16 
6
1 2 4 5 6 16 50 
7
1 2 4 5 6 16 50 52 
8
1 2 4 5 6 36 49 69 73 
10
1 2 4 5 6 16 6 36 49 69 73 
12
1 2 4 5 6 16 50 16 6 36 49 69 73 
14
1 2 4 5 6 16 50 52 50 16 6 36 49 69 73 
16
1 2 4 5 6 16 50 84 50 52 50 16 6 36 49 69 73 
18
1 2 4 5 6 ...

result:

ok All testcases are passed!

Test #10:

score: 0
Accepted
time: 70ms
memory: 36716kb

input:

100
100 1
1 1 1 2 2 5 7 3 4 5 7 12 4 9 1 7 11 2 4 19 6 22 5 21 11 12 6 3 9 21 2 22 28 25 23 20 31 7 28 34 13 32 8 5 44 8 24 43 39 44 42 34 36 6 37 42 54 13 46 49 27 51 24 42 2 13 37 66 66 59 7 65 4 14 27 28 26 52 68 25 61 51 40 31 49 64 42 40 44 8 33 22 13 38 32 88 62 93 88
100 2
1 1 1 2 2 5 7 3 4 5...

output:

0
1 
1
1 2 
2
1 2 5 
3
1 2 5 7 
4
1 2 5 7 8 
5
1 2 5 7 8 44 
6
1 2 5 7 8 44 46 
7
1 2 5 7 8 44 46 60 
8
1 2 5 7 12 13 42 52 79 
10
1 2 5 7 12 13 42 57 42 52 79 
12
1 2 5 7 12 13 42 52 79 52 42 65 73 
14
1 2 5 7 12 13 42 57 42 52 79 52 42 65 73 
16
1 2 5 7 12 13 42 57 42 52 79 52 42 88 97 88 100 
18
...

result:

ok All testcases are passed!

Test #11:

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

input:

100
100 1
1 2 1 1 4 4 5 8 7 8 10 7 11 12 8 16 2 14 17 7 6 14 5 5 8 5 23 11 19 30 7 23 3 14 10 33 11 30 39 33 15 34 39 24 37 33 34 35 15 39 19 37 40 51 7 12 10 57 29 26 22 18 44 63 4 37 6 38 23 48 47 13 19 41 73 67 8 65 14 42 47 1 15 78 48 27 25 45 15 37 23 32 18 57 14 14 83 58 78
100 2
1 2 1 1 4 4 5...

output:

0
1 
1
1 2 
2
1 2 3 
3
1 2 3 34 
4
1 2 3 34 43 
5
1 2 3 34 48 71 
6
1 4 7 10 12 15 42 
7
1 4 7 10 12 15 42 81 
8
1 5 8 11 14 19 30 39 40 
9
1 5 8 11 14 19 30 39 40 54 
11
1 5 8 11 14 19 30 39 40 39 44 64 
13
1 5 8 11 14 19 30 39 40 54 40 39 44 64 
15
1 5 8 11 14 19 30 39 44 64 44 39 40 39 51 55 
17
...

result:

ok All testcases are passed!

Test #12:

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

input:

100
100 1
1 1 2 1 5 2 5 5 9 2 10 9 1 14 11 14 10 6 8 4 11 1 2 14 17 17 3 7 24 18 29 26 32 17 25 21 23 37 12 39 33 4 7 8 8 28 11 45 38 25 7 29 29 52 46 3 29 10 6 22 53 40 14 41 19 32 55 33 42 8 58 16 35 59 4 64 66 3 9 29 7 69 60 60 4 1 37 5 3 6 7 67 44 2 17 60 28 79 31
100 2
1 1 2 1 5 2 5 5 9 2 10 9 ...

output:

0
1 
1
1 2 
2
1 2 4 
3
1 2 4 21 
4
1 2 4 21 37 
5
1 2 4 21 37 39 
6
1 2 4 21 37 39 41 
7
1 2 4 21 37 39 41 65 
9
1 2 4 21 37 88 37 39 41 65 
11
1 2 4 43 4 21 37 88 37 39 41 65 
13
1 2 4 76 4 43 4 21 37 88 37 39 41 65 
15
1 2 4 86 4 76 4 43 4 21 37 88 37 39 41 65 
17
1 2 7 29 32 67 93 67 32 29 7 2 4 ...

result:

ok All testcases are passed!

Test #13:

score: 0
Accepted
time: 70ms
memory: 43180kb

input:

100
100 34
1 1 3 1 4 3 3 2 5 5 3 1 6 4 3 7 1 18 2 5 12 15 2 14 16 10 20 15 12 26 3 27 5 6 35 14 26 6 35 39 37 6 38 27 8 7 21 38 14 22 35 33 33 43 16 29 26 4 47 59 47 7 34 62 21 56 24 13 28 10 28 36 50 64 50 26 48 17 34 46 57 17 34 22 46 50 20 10 85 35 88 38 49 88 94 82 50 44 21
100 74
1 1 2 3 3 6 7 ...

output:

59
1 3 7 63 7 47 62 65 62 47 60 47 7 17 83 17 79 17 7 3 4 6 35 91 35 52 35 40 35 36 73 36 35 6 14 50 98 50 87 50 76 50 74 50 14 37 42 37 14 25 14 6 4 15 23 15 29 57 82 97 
136
1 3 6 23 76 23 6 14 32 84 32 79 32 47 67 47 59 47 32 38 83 38 55 100 55 63 87 63 55 38 40 38 32 33 89 33 32 14 22 14 6 11 43...

result:

ok All testcases are passed!

Test #14:

score: 0
Accepted
time: 74ms
memory: 43132kb

input:

100
100 50
1 2 3 3 4 3 7 5 2 8 1 6 3 7 13 12 10 17 19 6 9 15 1 5 24 7 13 21 26 9 19 25 20 14 16 32 26 7 17 32 27 41 39 14 23 23 38 45 41 30 27 49 52 47 39 48 18 31 40 8 4 43 38 63 12 47 49 21 60 29 17 32 63 5 62 46 29 27 64 28 52 8 25 50 5 82 70 83 39 36 28 35 33 85 54 48 51 51 50
100 10
1 1 1 1 3 5...

output:

90
1 2 3 7 39 90 39 56 39 44 39 7 27 79 27 52 82 87 82 52 54 96 54 52 27 42 27 7 15 23 47 67 47 55 47 23 46 77 46 23 15 7 8 83 89 83 8 61 8 11 8 7 3 5 86 5 75 5 25 84 25 33 94 33 25 5 9 31 59 31 9 22 9 5 3 4 6 21 69 21 29 78 29 71 29 21 6 13 16 36 91 
9
1 3 6 11 14 19 21 34 49 63 
126
1 3 5 13 99 13...

result:

ok All testcases are passed!

Test #15:

score: 0
Accepted
time: 69ms
memory: 43132kb

input:

100
100 29
1 2 2 2 1 3 5 1 6 1 7 2 7 11 4 5 1 11 13 15 10 9 1 6 20 26 3 28 15 17 25 26 25 29 3 8 6 14 1 40 29 1 27 33 16 3 1 37 17 27 29 25 4 23 22 34 32 16 23 45 60 9 58 20 15 7 18 61 16 19 58 52 21 32 33 25 10 68 9 44 37 39 82 13 4 45 53 88 32 66 18 5 38 78 36 70 7 16 40
100 98
1 2 1 3 4 5 7 4 5 8...

output:

48
1 2 3 28 29 52 73 52 29 42 29 35 29 28 3 7 14 39 83 39 14 7 12 7 3 2 13 85 13 20 65 20 26 27 51 27 44 81 44 27 26 33 76 33 45 87 45 61 69 
182
1 22 78 22 1 19 61 19 45 72 84 72 74 72 45 19 29 94 29 39 81 39 29 19 1 12 98 12 92 12 38 93 38 12 1 4 24 25 85 25 30 25 26 28 26 25 24 4 9 40 9 4 6 32 52...

result:

ok All testcases are passed!

Test #16:

score: 0
Accepted
time: 69ms
memory: 42784kb

input:

100
100 78
1 2 1 4 4 5 1 4 5 6 1 9 7 8 12 14 16 16 12 20 14 22 1 9 22 3 25 17 12 20 25 8 26 6 24 29 23 26 12 26 18 26 22 8 26 30 27 2 30 11 10 32 31 2 49 24 27 39 4 34 36 29 40 25 4 51 21 50 59 17 25 42 15 8 15 24 54 61 39 42 9 48 75 10 58 70 36 23 59 89 81 6 82 85 52 52 14 25 99
100 69
1 1 3 3 3 1 ...

output:

144
1 12 40 64 40 12 30 50 69 50 30 47 30 12 20 31 54 78 54 31 20 21 68 21 20 12 16 19 16 18 42 81 92 81 42 73 42 18 16 12 1 2 3 2 1 4 66 4 60 4 9 82 94 82 9 25 99 100 99 25 72 25 65 25 32 53 32 25 28 25 9 13 9 4 6 93 6 35 6 11 51 67 51 11 6 4 5 10 85 95 85 10 52 97 52 96 52 10 5 7 14 98 14 17 71 17...

result:

ok All testcases are passed!

Test #17:

score: 0
Accepted
time: 79ms
memory: 44224kb

input:

100
100 56
1 2 2 3 3 4 1 8 8 9 5 4 12 10 4 7 7 10 6 8 15 14 2 9 19 20 25 24 21 21 31 9 33 28 34 21 3 33 24 26 22 28 10 28 18 16 11 43 6 8 13 36 35 32 19 50 24 33 46 11 30 57 60 46 9 12 58 21 44 19 66 62 30 13 61 63 35 25 63 27 75 78 52 57 58 34 19 28 30 29 16 68 87 77 33 42 35 88 89
100 57
1 1 1 1 4...

output:

102
1 8 21 69 21 37 21 31 32 55 32 31 21 30 90 30 74 30 62 73 62 30 21 8 10 44 70 44 10 19 88 99 88 19 71 19 56 19 26 41 26 19 10 15 22 42 97 42 22 15 10 8 9 33 96 33 59 33 39 33 34 87 94 87 34 36 53 36 34 33 9 25 28 89 100 89 28 43 49 43 28 35 98 35 78 83 78 35 54 35 28 25 9 8 1 2 3 6 50 57 63 77 9...

result:

ok All testcases are passed!