QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#630070#9432. Permutationucup-team2055AC ✓228ms3888kbC++234.9kb2024-10-11 16:19:432024-10-11 16:19:43

详细

Test #1:

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

input:

5
0
1
2
0
1
0
3

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 200ms
memory: 3596kb

input:

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

output:

0 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 17...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
0
1
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
2
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
1
0
2
1
2
2
3
4
3

output:

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

result:

ok Accepted

Test #8:

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

input:

7
1
0
1
0
1
0
0
2
4
4
5
4

output:

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

result:

ok Accepted

Test #9:

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

input:

8
1
1
1
1
1
1
0
0
0
2
2
4
6
6
8

output:

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

result:

ok Accepted

Test #10:

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

input:

9
0
1
0
1
0
1
1
2
2
2
1
0
3
7
5
7
7

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

13
2
1
1
0
1
1
0
2
1
2
1
0
2
1
1
0
2
4
4
5
4
9
7
7
8
9
7
10
11
10

output:

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

result:

ok Accepted

Test #15:

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

input:

14
2
1
1
2
1
1
0
1
1
0
0
1
2
2
0
2
0
4
5
6
4
8
8
8
8
9
8
9
9
7
11
11
12
11

output:

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

result:

ok Accepted

Test #16:

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

input:

15
2
2
1
1
0
0
2
0
1
0
0
2
0
2
2
2
2
5
5
4
4
6
10
10
8
9
10
8
8
10
14
13
14

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 820 82...

result:

ok Accepted

Test #18:

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

input:

976
1
1
0
2
1
1
0
1
0
1
2
0
0
2
2
1
2
2
1
2
2
2
0
1
1
1
2
0
0
2
2
1
1
2
1
1
1
0
0
1
1
2
0
1
0
1
2
2
2
1
2
1
2
2
1
0
1
2
0
0
1
0
1
1
1
2
1
1
0
0
1
1
2
1
1
0
0
2
1
0
2
0
0
1
2
1
1
2
2
0
0
2
1
2
2
2
0
2
1
2
2
2
0
0
2
2
0
1
0
1
1
1
1
1
1
2
1
0
1
2
1
1
0
2
0
0
1
1
1
2
1
0
0
0
1
1
1
0
0
1
0
1
0
2
2
2
2
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 #19:

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

input:

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

output:

0 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 629 62...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 135 13...

result:

ok Accepted

Test #21:

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

input:

979
0
1
1
2
1
2
2
1
1
2
2
1
2
1
1
0
1
2
1
0
1
1
0
0
1
2
0
1
1
1
1
1
1
1
0
0
2
2
1
0
1
0
1
2
1
2
0
1
1
2
0
1
1
1
1
1
2
1
2
1
2
0
0
2
2
1
1
0
0
0
1
0
2
1
0
1
1
1
1
2
2
0
2
0
1
2
1
1
1
2
1
2
2
0
0
2
1
0
1
0
0
0
1
0
1
1
1
1
1
0
2
1
1
2
0
1
1
0
1
1
2
1
1
1
2
1
2
1
1
1
1
1
1
1
1
2
2
1
0
2
1
0
1
1
1
2
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 #22:

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

input:

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

output:

0 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 685 68...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 25...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 505 50...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 362 36...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 6...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 132 13...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 102 10...

result:

ok Accepted

Test #29:

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

input:

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

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

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

input:

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

output:

0 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 31...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 210ms
memory: 3656kb

input:

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

output:

0 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 41...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 621 62...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 967 96...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 558 55...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 227ms
memory: 3544kb

input:

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

output:

0 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 11...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 519 51...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 373 37...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 253 25...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 713 71...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 84...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 220ms
memory: 3656kb

input:

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

output:

0 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 ...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed