QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740430#9432. PermutationHuluoboWA 283ms3864kbC++141.5kb2024-11-13 09:54:482024-11-13 09:54:50

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 956 436 95...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2
0
1
1
1
1
1
1
1
1

output:

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

result:

ok Accepted

Test #5:

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

input:

3
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

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

result:

ok Accepted

Test #6:

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

input:

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

output:

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

result:

ok Accepted

Test #7:

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

input:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 694 819 69...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 69 582 ...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 752 408 75...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 315 936 31...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 662 592 66...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 391 888 39...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 465 842 46...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 428 976 42...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 248ms
memory: 3792kb

input:

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

output:

0 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 60 950 ...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 703 798 70...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 599 33 5...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 441 31 4...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 812 807 81...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 179 452 17...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 101 93 1...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 633 740 63...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 949 212 94...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 855 376 85...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 864 265 86...

result:

ok Accepted

Test #36:

score: -100
Wrong Answer
time: 253ms
memory: 3708kb

input:

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

output:

0 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 92 150 ...

result:

wrong answer More than 6666 quries