QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#598496#9432. Permutationucup-team025#AC ✓328ms4040kbC++2011.2kb2024-09-28 22:09:392024-09-28 22:09:44

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
0
0
2
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 388 38...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
1
2
2
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
2
0
1
2
0
2

output:

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

result:

ok Accepted

Test #8:

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

input:

7
0
2
0
1
2
1
1
2
0
2

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 364 36...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 291ms
memory: 3776kb

input:

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

output:

0 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 829 82...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 573 57...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 563 56...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 671 67...

result:

ok Accepted

Test #22:

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

input:

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

output:

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

result:

ok Accepted

Test #23:

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

input:

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

output:

0 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 6...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 291ms
memory: 3840kb

input:

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

output:

0 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 423 42...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 281ms
memory: 4004kb

input:

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

output:

0 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 979 97...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 720 72...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 439 43...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 692 69...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 281ms
memory: 3764kb

input:

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

output:

0 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 234 23...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 933 93...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 813 81...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 509 50...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 569 56...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 137 13...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 5...

result:

ok Accepted

Test #37:

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

input:

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

output:

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

result:

ok Accepted

Test #38:

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

input:

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

output:

0 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 29...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 308ms
memory: 4000kb

input:

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

output:

0 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 794 79...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 62...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 295ms
memory: 3940kb

input:

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

output:

0 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 405 40...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed