QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740419#9432. PermutationHuluoboWA 291ms3892kbC++141.5kb2024-11-13 09:51:272024-11-13 09:51:32

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 279ms
memory: 3840kb

input:

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

output:

0 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 229 206 22...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0
0
1
1
1
1
1
1
1
1

output:

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

result:

ok Accepted

Test #5:

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

input:

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

output:

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

result:

ok Accepted

Test #6:

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

input:

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

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 237ms
memory: 3616kb

input:

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

output:

0 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 591 64 5...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 258 351 25...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 851 233 85...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 809 56 8...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 466 956 46...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 917 257 91...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 237ms
memory: 3696kb

input:

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

output:

0 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 303 902 30...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 722 732 72...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 134 872 13...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 309 652 30...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 148 220 14...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 246ms
memory: 3592kb

input:

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

output:

0 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 480 623 48...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 352 12 3...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 291ms
memory: 3848kb

input:

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

output:

0 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 972 35 9...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 408 467 40...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 258ms
memory: 3844kb

input:

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

output:

0 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 216 704 21...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 684 288 68...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 256ms
memory: 3696kb

input:

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

output:

0 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 636 861 63...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 544 950 54...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 244 523 24...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 250ms
memory: 3844kb

input:

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

output:

0 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 939 210 93...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 258ms
memory: 3816kb

input:

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

output:

0 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 872 637 87...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 289ms
memory: 3656kb

input:

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

output:

0 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 40 598 ...

result:

ok Accepted

Test #40:

score: -100
Wrong Answer
time: 258ms
memory: 3652kb

input:

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

output:

0 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 227 693 22...

result:

wrong answer More than 6666 quries