QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#740435#9432. PermutationReTFWA 275ms3868kbC++141.4kb2024-11-13 09:55:532024-11-13 09:55:54

詳細信息

Test #1:

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

input:

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

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 727 440 72...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0
2
1
1
1
1
1
1
1
1

output:

0 1 2 
0 2 1 
0 1 1 
0 2 2 
0 2 2 
0 2 2 
0 1 1 
0 2 2 
0 2 2 
0 1 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

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

output:

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

result:

ok Accepted

Test #6:

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

input:

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

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 336 764 33...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 240ms
memory: 3588kb

input:

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

output:

0 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 400 490 40...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 1 102 ...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 759 434 75...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 287 659 28...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 240ms
memory: 3588kb

input:

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

output:

0 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 943 611 94...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 969 907 96...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 238ms
memory: 3648kb

input:

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

output:

0 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 198 553 19...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 249ms
memory: 3548kb

input:

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

output:

0 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 82 725 ...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 223ms
memory: 3868kb

input:

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

output:

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

result:

ok Accepted

Test #27:

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

input:

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

output:

0 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 885 225 88...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 975 453 97...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 786 280 78...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 821 926 82...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 611 290 61...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 696 610 69...

result:

ok Accepted

Test #33:

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

input:

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

output:

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

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 249ms
memory: 3672kb

input:

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

output:

0 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 765 86 7...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 988 240 98...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 840 43 8...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 438 35 4...

result:

ok Accepted

Test #38:

score: -100
Wrong Answer
time: 250ms
memory: 3640kb

input:

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

output:

0 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 738 485 73...

result:

wrong answer More than 6666 quries