QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#595621#9432. Permutationucup-team3515#AC ✓240ms4032kbC++174.9kb2024-09-28 14:08:062024-09-28 14:08:06

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3660kb

input:

5
0
0
0
1
1
0
1
3
5
3

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 226ms
memory: 3760kb

input:

1000
1
1
1
1
0
1
0
2
1
1
0
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
1
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
2
0
1
0
0
1
0
2
0
1
2
1
0
1
1
1
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
0
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
2
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #3:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

1

output:

1 1

result:

ok Accepted

Test #4:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

2
2
2

output:

0 2 1 
0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

3
0
1
3
1

output:

0 2 3 3 
0 2 1 1 
0 3 1 2 
0 3 2 1 
1 3 1 2 

result:

ok Accepted

Test #6:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

4
2
1
0
0
2
2
4

output:

0 3 3 3 1 
0 4 4 4 2 
0 1 1 1 2 
0 2 1 1 2 
0 3 4 4 3 
0 3 2 4 1 
0 3 4 2 1 
1 3 4 2 1 

result:

ok Accepted

Test #7:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

6
2
0
0
1
1
2
0
4
6
4

output:

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

result:

ok Accepted

Test #8:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

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

output:

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

result:

ok Accepted

Test #9:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

8
1
1
1
0
1
1
1
2
2
2
2
2
1
2
1
2
4
6
4
8

output:

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

result:

ok Accepted

Test #10:

score: 0
Accepted
time: 1ms
memory: 3972kb

input:

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

output:

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

result:

ok Accepted

Test #11:

score: 0
Accepted
time: 1ms
memory: 3728kb

input:

10
1
1
1
0
1
0
1
1
2
1
1
1
0
0
0
2
2
2
1
1
2
6
4
4
8
10

output:

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

result:

ok Accepted

Test #12:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

11
2
1
1
1
2
0
1
1
1
0
2
1
0
1
0
0
2
1
1
1
2
2
7
5
5
9
11
9

output:

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

result:

ok Accepted

Test #13:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

12
1
1
0
0
0
1
0
1
2
1
0
1
0
1
0
0
2
0
1
1
1
1
1
1
2
10
8
8
12
10
10

output:

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

result:

ok Accepted

Test #14:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

13
2
1
1
1
2
1
0
0
1
1
2
1
1
1
2
2
0
0
1
2
1
1
1
2
2
0
1
9
7
7
11
9
9
13

output:

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

result:

ok Accepted

Test #15:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

14
1
1
0
2
0
1
1
0
0
1
1
0
2
2
1
1
2
0
1
1
2
1
1
1
1
2
2
0
10
8
8
12
10
10
14

output:

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

result:

ok Accepted

Test #16:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

15
1
1
1
0
2
1
1
2
1
1
2
1
2
2
2
2
2
1
2
1
1
1
2
1
2
0
0
1
1
2
11
9
9
13
11
11
15
13

output:

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

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 219ms
memory: 3768kb

input:

975
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
1
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
1
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
1
1
1
0
0
0
1
1
2
0
2
1
0
1
1
1
2
0
2
2
2
2
2
1
0
2
2
1
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
1
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 217ms
memory: 4028kb

input:

976
1
1
1
1
0
1
0
2
1
1
1
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
0
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
1
1
0
2
0
2
2
1
0
1
1
2
1
0
2
1
1
2
1
0
1
1
1
1
0
1
1
2
1
1
1
1
1
1
1
1
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
1
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 218ms
memory: 4008kb

input:

977
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
1
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
1
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
0
1
1
2
0
2
1
0
1
1
1
2
0
2
2
2
2
2
1
0
2
2
1
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #20:

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

input:

978
1
1
1
1
0
1
0
2
1
1
1
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
0
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
1
1
0
2
0
2
2
1
0
1
1
2
1
0
2
1
1
2
1
0
1
1
1
1
0
1
1
2
1
1
1
1
1
1
1
1
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
1
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 213ms
memory: 3796kb

input:

979
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
1
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
1
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
0
1
1
2
0
2
1
0
1
1
0
2
0
2
2
2
2
2
1
0
2
2
1
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 210ms
memory: 3716kb

input:

980
1
1
1
1
0
1
0
2
1
1
1
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
0
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
1
1
0
2
0
2
2
1
0
1
1
2
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
1
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
1
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 220ms
memory: 3764kb

input:

981
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
0
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
1
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
0
1
1
2
0
2
1
0
1
1
0
2
0
2
2
2
2
2
1
0
2
2
1
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 214ms
memory: 3708kb

input:

982
1
1
1
1
0
1
0
2
1
1
1
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
0
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
1
1
0
2
0
2
2
1
0
1
1
2
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
1
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
1
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 212ms
memory: 3824kb

input:

983
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
0
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
1
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
0
1
1
2
0
2
1
0
1
1
0
2
0
2
2
2
2
2
1
0
2
2
1
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 208ms
memory: 4032kb

input:

984
1
1
1
1
0
1
0
2
1
1
1
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
0
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
1
1
0
2
0
2
2
1
0
1
1
2
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
1
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
1
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 214ms
memory: 3772kb

input:

985
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
0
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
1
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
0
1
1
2
0
2
1
0
1
1
0
2
0
2
2
2
2
2
1
0
2
2
1
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 187ms
memory: 3772kb

input:

986
1
1
1
1
0
1
0
2
1
1
1
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
0
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
1
1
0
2
0
2
2
1
0
1
1
1
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
1
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
1
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 216ms
memory: 3928kb

input:

987
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
0
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
1
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
0
1
1
2
0
2
1
0
1
1
0
2
0
2
2
2
2
2
1
0
2
2
1
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 207ms
memory: 3724kb

input:

988
1
1
1
1
0
1
0
2
1
1
1
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
0
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
1
1
0
2
0
2
2
1
0
1
1
1
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
1
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
1
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 220ms
memory: 3772kb

input:

989
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
0
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
1
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
0
1
1
2
0
2
1
0
1
1
0
2
0
2
2
2
2
2
1
0
2
2
1
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 215ms
memory: 3732kb

input:

990
1
1
1
1
0
1
0
2
1
1
1
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
1
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
1
1
0
2
0
2
2
1
0
1
1
1
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
1
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
2
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 240ms
memory: 3744kb

input:

991
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
0
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
1
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
1
1
1
2
0
2
1
0
1
1
0
2
0
2
2
2
2
2
1
0
2
2
1
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 229ms
memory: 3812kb

input:

992
1
1
1
1
0
1
0
2
1
1
0
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
1
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
1
1
0
2
0
2
2
1
0
1
1
1
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
0
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
2
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 214ms
memory: 4004kb

input:

993
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
0
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
1
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
1
1
1
2
0
2
1
0
1
1
0
1
0
2
2
2
2
2
1
0
2
2
0
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 224ms
memory: 3704kb

input:

994
1
1
1
1
0
1
0
2
1
1
0
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
1
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
1
1
0
2
0
1
2
1
0
1
1
1
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
0
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
2
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 224ms
memory: 3712kb

input:

995
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
0
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
0
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
1
1
1
2
0
2
1
0
1
1
0
1
0
2
2
2
2
2
1
0
2
2
0
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 218ms
memory: 3712kb

input:

996
1
1
1
1
0
1
0
2
1
1
0
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
1
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
0
1
0
2
0
1
2
1
0
1
1
1
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
0
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
2
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 216ms
memory: 3772kb

input:

997
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
0
1
2
1
2
0
1
2
1
0
1
0
0
1
2
2
0
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
1
1
1
2
0
2
1
0
1
1
0
1
0
2
2
2
2
2
1
0
2
2
0
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 223ms
memory: 3828kb

input:

998
1
1
1
1
0
1
0
2
1
1
0
1
1
0
1
1
0
0
2
1
0
1
0
1
2
1
1
0
0
1
1
2
1
2
0
1
1
1
1
1
1
1
0
1
1
1
1
2
0
1
1
1
0
1
0
2
1
2
0
1
1
1
1
0
1
0
0
1
0
2
0
1
2
1
0
1
1
1
1
0
2
1
1
2
1
0
1
1
1
1
0
2
1
2
1
1
1
1
1
1
1
0
2
0
1
0
2
2
2
1
2
1
1
1
1
1
1
2
0
0
2
1
1
2
1
1
1
0
1
1
2
1
2
2
1
0
2
0
0
1
1
1
0
0
1
1
2
2
...

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 228ms
memory: 4004kb

input:

999
0
0
2
1
1
0
0
1
1
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
0
1
0
1
1
2
2
0
1
2
1
2
1
1
2
1
0
1
0
0
1
2
2
0
0
2
2
1
0
0
0
0
1
1
1
0
1
1
1
1
2
1
2
1
1
2
2
1
2
0
1
1
2
1
2
0
2
0
1
1
0
0
1
1
1
2
0
2
1
0
1
1
0
1
0
2
2
2
2
2
1
0
2
2
0
2
2
1
0
0
0
1
1
0
2
0
1
2
1
1
1
2
1
0
1
1
2
1
0
0
2
2
0
1
1
0
0
1
1
2
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed