QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#269986#5665. AA Country and King DreamoonDennisTranWA 25ms5916kbC++201.7kb2023-11-30 13:21:132023-11-30 13:21:14

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5788kb

input:

9
5
1 2 3 2 0 2 1 5 1
5
1 2 3 0 0 2 1 5 1
5
1 2 0 0 0 2 1 5 1
5
1 2 0 0 0 0 1 5 1
5
1 0 0 0 0 0 1 5 1
5
1 0 0 0 0 0 0 5 1
5
1 0 0 0 0 0 0 0 1
5
1 0 0 0 0 0 0 0 0
5
0 0 0 0 0 0 0 0 0

output:

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

result:

ok 9 lines

Test #2:

score: 0
Accepted
time: 24ms
memory: 5764kb

input:

28668
2
0 2 1
2
0 0 1
2
0 0 0
2
1 0 1
2
1 0 0
2
1 2 0
3
0 2 1 3 1
3
0 0 1 3 1
3
0 0 0 3 1
3
0 0 0 0 1
3
0 0 0 0 0
3
1 0 1 3 1
3
1 0 0 3 1
3
1 0 0 0 1
3
1 0 0 0 0
3
1 2 0 3 1
3
1 2 0 0 1
3
1 2 0 0 0
3
1 2 1 0 1
3
1 2 1 0 0
3
1 2 1 3 0
3
0 2 3 2 1
3
0 0 3 2 1
3
0 0 0 2 1
3
1 0 3 2 1
3
1 0 0 2 1
3
1 2 ...

output:

1 2 1
1 2 1
1 2 1
1 2 1
1 2 1
1 2 1
1 2 1 3 1
1 2 1 3 1
1 2 1 3 1
1 2 1 3 1
1 2 1 3 1
1 2 1 3 1
1 2 1 3 1
1 2 1 3 1
1 2 1 3 1
1 2 1 3 1
1 2 1 3 1
1 2 1 3 1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2 1 6 1 3 1 5 1 4 1
1 2 7 2 1 6 1 3 1 5 1 4 1
1 2 7 2 1 6 1 3 1 5 1 4 1
1 2 7 2 1 6 1 ...

result:

ok 23077 lines

Test #28:

score: 0
Accepted
time: 20ms
memory: 5788kb

input:

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

output:

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

result:

ok 23077 lines

Test #29:

score: -100
Wrong Answer
time: 24ms
memory: 5788kb

input:

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

output:

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

result:

wrong answer 10468th lines differ - expected: '1 40 59 47 2 3 2 4 2 5 2 6 2 7...1 89 1 90 1 91 1 92 1 93 1 94 1', found: '1 40 59 47 1 2 1 3 1 4 1 5 1 6...1 90 1 91 1 92 1 93 1 94 1 95 1'