QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#747360#9432. PermutationHuluoboAC ✓219ms4024kbC++143.6kb2024-11-14 16:58:532024-11-14 16:58:53

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
2
0
1
2
2
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 414 41...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
2
2
1
2
2
2
0

output:

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

result:

ok Accepted

Test #8:

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

input:

7
0
2
1
2
1
0
0
2
2
0

output:

0 4 4 4 4 7 7 7 
0 2 2 2 2 5 5 5 
0 1 1 1 1 3 3 3 
0 1 1 1 1 6 6 6 
0 1 1 2 2 2 2 2 
0 1 1 3 3 3 3 3 
0 7 3 3 3 3 3 3 
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: 3700kb

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 522 52...

result:

ok Accepted

Test #18:

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

input:

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

output:

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

result:

ok Accepted

Test #19:

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

input:

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

output:

0 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 2...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 208ms
memory: 3784kb

input:

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

output:

0 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 178 17...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 159 15...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 319 31...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 197ms
memory: 4024kb

input:

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

output:

0 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 387 38...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 193ms
memory: 3728kb

input:

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

output:

0 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 807 80...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 725 72...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 849 84...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 272 27...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 194ms
memory: 4016kb

input:

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

output:

0 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 306 30...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 203ms
memory: 3944kb

input:

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

output:

0 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 755 75...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 181ms
memory: 3740kb

input:

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

output:

0 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 654 65...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 199ms
memory: 3804kb

input:

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

output:

0 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 378 37...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 266 26...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 202ms
memory: 3732kb

input:

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

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 #34:

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

input:

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

output:

0 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 941 94...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 205ms
memory: 3768kb

input:

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

output:

0 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 3...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 172ms
memory: 3944kb

input:

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

output:

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

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 219ms
memory: 4024kb

input:

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

output:

0 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 72...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 198ms
memory: 3944kb

input:

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

output:

0 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 11...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 197ms
memory: 3964kb

input:

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

output:

0 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 973 97...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 52...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 208ms
memory: 3804kb

input:

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

output:

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

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed