QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#595008#9432. Permutationucup-team4689#AC ✓305ms3992kbC++144.6kb2024-09-28 12:00:402024-09-28 12:00:41

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
2
2
0
3
1

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 285ms
memory: 3724kb

input:

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

output:

0 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 138 13...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
3

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
1
3

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
0
0
2
3
0
3

output:

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

result:

ok Accepted

Test #8:

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

input:

7
2
2
0
2
3
1
1
1
2
3

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

0 9 9 9 9 9 9 12 12 12 12 12 12 
0 3 3 3 3 3 3 8 8 8 8 8 8 
0 10 10 10 10 10 10 1 1 1 1 1 1 
0 10 10 10 10 10 10 6 6 6 6 6 6 
0 7 7 7 7 7 7 4 4 4 4 4 4 
0 5 5 5 5 5 5 11 11 11 11 11 11 
0 10 10 10 5 5 5 5 5 5 5 5 5 
0 7 7 7 3 3 3 3 3 3 3 3 3 
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: 1ms
memory: 3704kb

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 781 78...

result:

ok Accepted

Test #18:

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

input:

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

output:

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

result:

ok Accepted

Test #19:

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

input:

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

output:

0 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 945 94...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 305 30...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 457 45...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 531 53...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 957 95...

result:

ok Accepted

Test #26:

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

input:

984
2
2
0
0
1
2
1
0
2
1
1
1
1
1
0
1
1
2
1
1
1
2
0
2
0
1
1
0
2
1
1
1
2
2
0
0
1
1
2
2
1
2
1
1
2
2
1
1
1
2
0
2
2
1
1
1
0
0
1
1
0
0
0
2
2
1
2
1
1
0
1
1
1
1
0
0
1
2
1
2
0
0
2
1
1
1
1
2
0
1
2
2
2
1
0
1
1
0
1
2
1
1
1
1
0
1
2
2
1
2
1
2
0
2
1
1
1
0
1
2
2
1
0
2
1
2
1
1
0
1
0
1
2
1
1
0
1
2
1
1
0
1
1
2
1
0
1
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 #27:

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

input:

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

output:

0 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 892 89...

result:

ok Accepted

Test #28:

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

input:

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

output:

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

result:

ok Accepted

Test #29:

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

input:

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

output:

0 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 12...

result:

ok Accepted

Test #30:

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

input:

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

output:

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

result:

ok Accepted

Test #31:

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

input:

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

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 2...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 278ms
memory: 3960kb

input:

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

Test #34:

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

input:

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

output:

0 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 49...

result:

ok Accepted

Test #35:

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

input:

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

output:

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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 4...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 5...

result:

ok Accepted

Test #38:

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

input:

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

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

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

input:

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

output:

0 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 5...

result:

ok Accepted

Test #40:

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

input:

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

output:

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

result:

ok Accepted

Test #41:

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

input:

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

output:

0 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 51...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed