QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#745782#9432. PermutationHuluoboAC ✓282ms4168kbC++141.9kb2024-11-14 11:36:032024-11-14 11:36:03

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
0
1
2
0
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 90...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
0
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
2
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
2
0
0
0
2
1
2
2

output:

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

result:

ok Accepted

Test #8:

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

input:

7
1
0
1
1
2
0
2
2
2
2
0

output:

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

result:

ok Accepted

Test #9:

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

input:

8
1
0
0
2
2
2
2
0
1
2
0
0

output:

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

result:

ok Accepted

Test #10:

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

input:

9
2
2
1
2
2
0
2
0
0
2
0
2
0
0

output:

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

result:

ok Accepted

Test #11:

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

input:

10
2
2
1
2
1
0
1
2
0
0
2
2
1
2
2
2
0
2

output:

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

result:

ok Accepted

Test #12:

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

input:

11
2
2
1
2
1
0
0
0
0
2
2
1
2
2
2
2
2
0
0

output:

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

result:

ok Accepted

Test #13:

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

input:

12
2
2
1
2
1
0
2
0
0
0
0
2
0
2
1
0
2
0
0
1
2
2

output:

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

result:

ok Accepted

Test #14:

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

input:

13
2
2
1
1
2
2
2
1
1
1
2
1
1
0
2
2
2
0
1
0
1
2
1
2
2
2
2

output:

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

result:

ok Accepted

Test #15:

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

input:

14
2
2
1
1
2
2
1
1
0
2
0
0
1
0
0
2
0
0
1
0
1
2
2
2
0
0
1
2
0

output:

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

result:

ok Accepted

Test #16:

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

input:

15
2
1
1
1
1
2
1
1
1
0
2
2
1
1
0
1
2
0
2
0
2
2
2
2
1
1
2
0
0
2
2
0
0
0

output:

0 9 9 9 9 9 9 9 9 6 6 6 6 6 6 6 
0 7 7 7 7 7 7 7 7 15 15 15 15 15 15 15 
0 15 15 15 15 15 15 15 15 1 1 1 1 1 1 1 
0 1 1 1 1 1 1 1 1 10 10 10 10 10 10 10 
0 10 10 10 10 10 10 10 10 13 13 13 13 13 13 13 
0 13 13 13 13 13 13 13 13 2 2 2 2 2 2 2 
0 14 14 14 14 14 14 14 14 3 3 3 3 3 3 3 
0 3 3 3 3 3 3 3 ...

result:

ok Accepted

Test #17:

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

input:

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

output:

0 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 136 13...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 816 81...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 267ms
memory: 4084kb

input:

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

output:

0 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 410 41...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 274ms
memory: 3912kb

input:

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

output:

0 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 912 91...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 489 48...

result:

ok Accepted

Test #22:

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

input:

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

output:

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

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 222ms
memory: 3920kb

input:

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

output:

0 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 795 79...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 69...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 53...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 14...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 729 72...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 50...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 568 56...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 14...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 68...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 17...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 27...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 579 57...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 644 64...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 238 23...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 792 79...

result:

ok Accepted

Test #38:

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

input:

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

output:

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

result:

ok Accepted

Test #39:

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

input:

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

output:

0 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 455 45...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 589 58...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 271ms
memory: 4076kb

input:

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

output:

0 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 10...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed