QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740426#9432. PermutationHuluoboWA 277ms3896kbC++141.5kb2024-11-13 09:53:522024-11-13 09:53:52

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 231ms
memory: 3692kb

input:

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

output:

0 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 704 352 70...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0
0
1
1
1
1
1
1
1
1

output:

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

result:

ok Accepted

Test #5:

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

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

result:

ok Accepted

Test #6:

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

input:

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

result:

ok Accepted

Test #7:

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

input:

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

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

result:

ok Accepted

Test #12:

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

input:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

result:

ok Accepted

Test #16:

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

input:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 368 213 36...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 241ms
memory: 3608kb

input:

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

output:

0 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 394 783 39...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 935 586 93...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 167 223 16...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 88 437 ...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 109 69 1...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 320 299 32...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 320 626 32...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 556 625 55...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 419 575 41...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 851 936 85...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 696 277 69...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 395 140 39...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 476 906 47...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 486 894 48...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 890 744 89...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 259ms
memory: 3876kb

input:

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

output:

0 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 641 78 6...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 295 455 29...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 386 764 38...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 391 658 39...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 19 559 ...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 889 869 88...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 370 825 37...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 334 545 33...

result:

ok Accepted

Test #41:

score: -100
Wrong Answer
time: 273ms
memory: 3740kb

input:

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

output:

0 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 113 438 11...

result:

wrong answer More than 6666 quries