QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740442#9432. PermutationReTFAC ✓273ms3884kbC++141.4kb2024-11-13 09:56:472024-11-13 09:56:48

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
1
1
0
2
2
1
1
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

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 263ms
memory: 3832kb

input:

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

output:

0 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 698 372 69...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2
0
1
1
1
1
1
1
1
1

output:

0 2 1 
0 1 2 
0 2 2 
0 1 1 
0 1 1 
0 2 2 
0 2 2 
0 2 2 
0 2 2 
0 2 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

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

result:

ok Accepted

Test #6:

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

input:

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

output:

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

result:

ok Accepted

Test #7:

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

input:

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

result:

ok Accepted

Test #8:

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

input:

7
1
1
2
2
0
0
1
0
2
2
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

output:

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

result:

ok Accepted

Test #9:

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

input:

8
0
1
0
1
2
0
2
1
1
0
2
1
2
1
0
1
1
1
0
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

output:

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

result:

ok Accepted

Test #10:

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

input:

9
2
1
1
1
2
0
0
0
1
2
2
0
1
0
1
1
0
2
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
1
1
1
1
1
1
1
1
1

output:

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

result:

ok Accepted

Test #11:

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

input:

10
2
2
1
1
0
0
1
2
2
2
1
2
2
1
0
1
1
2
1
0
1
0
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
1
1
1
1
1
1
1
1
1
1
1
1

output:

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

result:

ok Accepted

Test #12:

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

input:

11
1
1
2
1
2
1
1
0
2
1
2
1
0
0
1
0
0
1
0
1
0
0
1
2
1
1
1
0
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

output:

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

result:

ok Accepted

Test #13:

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

input:

12
0
2
2
1
1
2
2
0
1
2
1
1
1
1
1
0
0
2
0
1
2
0
1
0
1
2
0
1
0
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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

result:

ok Accepted

Test #15:

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

input:

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

result:

ok Accepted

Test #16:

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

input:

15
2
2
2
0
1
1
2
1
2
1
2
1
1
1
0
1
2
1
1
2
1
2
0
1
2
1
1
2
2
1
0
0
0
1
2
1
2
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
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 14 11 14 11 14 11 14 11 14 11 14 11 14 11 14 
0 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 
0 13 5 13 5 13 5 13 5 13 5 13 5 13 5 13 
0 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 
0 3 12 3 12 3 12 3 12 3 12 3 12 3 12 3 
0 1 15 1 15 1 15 1 15 1 15 1 15 1 15 1 
0 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 
0 12 10 12 10 12 10 12 10 12 10 ...

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 239ms
memory: 3648kb

input:

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

output:

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

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 264ms
memory: 3884kb

input:

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

output:

0 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 818 112 81...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 243ms
memory: 3864kb

input:

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

output:

0 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 497 553 49...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 239ms
memory: 3664kb

input:

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

output:

0 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 709 972 70...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 232ms
memory: 3580kb

input:

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

output:

0 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 605 766 60...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 242ms
memory: 3880kb

input:

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

output:

0 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 127 68 1...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 247ms
memory: 3540kb

input:

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

output:

0 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 900 227 90...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 257ms
memory: 3836kb

input:

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

output:

0 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 496 656 49...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 242ms
memory: 3664kb

input:

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

output:

0 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 394 95 3...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 627 178 62...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 257ms
memory: 3872kb

input:

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

output:

0 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 92 696 ...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 253ms
memory: 3668kb

input:

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

output:

0 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 618 412 61...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 251ms
memory: 3836kb

input:

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

output:

0 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 110 981 11...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 238ms
memory: 3864kb

input:

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

output:

0 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 604 830 60...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 252ms
memory: 3864kb

input:

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

output:

0 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 982 813 98...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 266ms
memory: 3880kb

input:

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

output:

0 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 535 883 53...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 255ms
memory: 3604kb

input:

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

output:

0 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 898 948 89...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 273ms
memory: 3664kb

input:

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

output:

0 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 201 866 20...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 263ms
memory: 3536kb

input:

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

output:

0 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 355 6 35...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 247ms
memory: 3672kb

input:

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

output:

0 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 650 410 65...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 262ms
memory: 3672kb

input:

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

output:

0 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 217 476 21...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 121 473 12...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 254ms
memory: 3644kb

input:

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

output:

0 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 468 337 46...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 244ms
memory: 3640kb

input:

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

output:

0 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 734 802 73...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 880 337 88...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed