QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#596937#9432. Permutationucup-team5077#AC ✓326ms3936kbC++143.2kb2024-09-28 16:44:082024-09-28 16:44:09

详细

Test #1:

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

input:

5
0
0
0
2
2
0
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 8 439 8 439 439 8 439 439 8 8 8 439 8 439 8 8 439 8 8 8 8 8 439 8 8 439 439 8 439 439 8 439 439 439 439 8 8 8 8 439 439 439 8 8 439 8 439 8 8 8 439 8 8 439 439 439 8 439 439 439 8 8 8 439 8 8 439 8 8 8 8 8 8 8 439 8 8 8 439 439 439 8 439 8 8 439 8 8 439 439 439 439 439 8 8 8 8 439 8 8 439 439 439 ...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
2
0
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
1
2
2
0
0
0
2
1
1
0
2

output:

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

result:

ok Accepted

Test #8:

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

input:

7
2
2
2
0
1
1
0
2
2
2
2
0

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 395 246 395 395 395 395 395 395 246 246 246 395 246 395 246 246 246 246 395 395 246 246 395 395 395 395 395 395 395 395 246 395 246 395 246 246 395 395 246 395 395 395 395 395 395 395 246 395 246 246 246 395 395 395 246 395 395 395 246 395 395 246 246 246 395 395 246 246 395 246 246 246 246 246 24...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 309ms
memory: 3708kb

input:

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

output:

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

result:

ok Accepted

Test #19:

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

input:

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

output:

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

result:

ok Accepted

Test #20:

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

input:

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

output:

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

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 309ms
memory: 3708kb

input:

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

output:

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

result:

ok Accepted

Test #22:

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

input:

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

output:

0 179 421 179 421 421 179 421 421 179 421 179 179 421 421 421 421 421 179 421 421 421 179 179 179 421 421 179 421 421 421 421 179 421 421 179 179 421 421 179 421 179 421 179 179 421 421 421 179 179 179 179 421 421 421 179 179 421 421 179 421 179 179 421 421 421 421 421 179 179 421 179 421 421 421 17...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 82 678 678 82 82 82 678 82 678 82 82 82 82 678 82 82 678 678 82 678 678 678 82 678 678 678 678 678 82 82 82 82 678 678 82 678 678 678 678 678 82 82 678 82 82 82 82 82 82 82 678 678 82 678 82 678 678 678 82 678 82 678 678 82 678 678 678 678 678 82 678 82 678 82 82 82 678 82 82 678 82 678 82 82 82 6...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 530 779 779 779 779 530 530 530 530 530 530 779 530 530 530 530 530 530 779 530 530 779 779 779 530 779 779 530 530 530 530 530 530 779 779 779 779 779 530 530 779 530 779 779 530 779 530 779 779 779 530 530 530 530 779 779 779 530 779 530 779 530 530 530 779 779 530 779 779 779 779 779 779 530 53...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 326 36 326 36 326 36 36 326 326 36 36 36 326 36 326 36 36 326 326 36 36 326 36 326 326 36 326 36 326 326 326 326 36 326 326 36 326 326 36 326 36 36 36 36 36 36 326 326 36 326 36 326 326 326 326 326 36 326 326 36 36 36 36 326 36 326 326 36 36 36 36 36 326 326 36 326 36 326 326 36 36 326 326 326 326...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 450 126 126 126 126 450 126 126 126 450 126 450 126 450 126 126 126 450 126 450 450 126 126 450 450 126 126 126 450 450 450 126 450 126 126 126 450 126 450 450 126 450 126 450 126 450 126 450 450 126 126 126 450 126 126 126 126 126 450 126 450 450 126 450 450 126 126 126 450 126 450 126 450 126 45...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 609 700 609 609 609 609 609 700 700 609 700 700 609 609 609 609 700 609 700 609 700 700 700 700 700 609 609 700 700 609 700 609 700 700 609 700 609 700 700 700 609 700 700 609 609 609 609 700 609 609 609 700 609 609 700 609 700 609 609 700 609 700 700 700 609 700 700 700 609 609 700 700 700 609 60...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 103 3 3 103 3 3 103 103 103 103 103 3 3 3 3 103 103 3 103 103 3 3 3 3 3 3 3 3 103 103 103 103 103 103 103 103 3 3 3 3 103 103 103 103 103 103 103 3 103 103 3 103 3 3 103 3 3 103 3 103 3 103 3 3 3 3 103 103 3 3 3 103 103 3 3 3 103 3 3 103 3 103 103 3 103 3 103 3 103 103 3 3 103 3 103 3 103 103 103 ...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 256 256 256 453 256 453 453 256 453 256 453 453 256 256 453 453 453 256 453 256 453 256 256 256 256 453 453 256 256 256 453 256 453 453 256 453 453 256 256 256 453 453 453 453 453 256 256 256 453 256 453 256 256 453 453 256 453 256 453 256 256 256 256 453 256 256 453 453 453 453 256 453 256 453 45...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 149 149 549 149 549 149 549 549 549 549 149 149 149 549 549 549 549 149 549 549 549 549 549 549 549 149 549 149 149 549 149 149 149 149 549 149 149 149 149 549 149 549 149 149 149 149 149 149 549 149 549 549 149 549 549 149 549 549 149 549 549 549 549 149 149 149 149 549 149 149 549 549 149 549 54...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 431 431 431 431 159 159 431 431 431 159 159 159 159 159 431 431 431 431 431 431 159 159 159 159 159 159 431 159 431 159 159 431 431 159 431 159 431 159 431 431 431 159 431 431 431 159 159 431 431 159 431 431 159 159 159 159 431 431 159 431 159 159 159 431 159 431 159 431 431 159 431 431 159 159 43...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 751 315 315 315 751 315 751 315 751 751 751 751 315 315 315 751 315 751 751 315 315 315 315 751 751 751 751 315 751 315 751 751 315 315 751 751 751 751 315 751 315 315 751 315 315 751 751 315 315 751 751 751 315 315 751 315 315 751 751 751 751 751 751 751 315 315 315 315 315 315 751 315 751 751 31...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 925 925 925 12 925 925 925 12 925 12 12 12 925 925 925 925 925 925 925 12 12 12 12 925 925 925 12 925 925 925 925 12 12 925 12 12 12 12 925 12 12 12 925 12 925 925 12 12 12 12 12 925 12 12 925 12 925 925 12 12 12 12 925 12 925 12 12 12 12 925 12 12 12 925 12 12 925 12 925 925 925 925 12 925 12 925...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 307ms
memory: 3928kb

input:

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

output:

0 951 139 951 139 951 951 139 139 951 139 951 139 951 139 139 139 951 139 951 951 139 139 139 139 951 951 139 951 139 139 139 951 139 951 139 951 951 139 951 951 139 139 139 139 139 951 139 951 139 951 951 951 951 139 951 139 951 139 951 951 951 139 139 139 951 139 951 139 951 951 139 139 139 139 95...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 942 530 942 530 530 530 942 530 942 942 530 530 530 942 530 530 942 530 530 530 530 530 942 942 942 530 942 942 942 530 942 530 942 530 942 530 530 530 942 942 530 530 530 942 942 942 942 942 530 942 942 942 530 530 942 942 530 942 530 942 530 942 530 942 942 530 942 530 942 942 530 942 530 530 94...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 980 203 203 980 203 980 203 980 980 203 203 203 203 203 203 980 203 203 980 980 980 980 203 980 203 980 980 980 980 980 980 203 980 203 980 980 203 980 980 980 203 980 980 980 203 203 203 980 980 203 980 980 980 980 203 203 203 203 980 980 203 203 203 980 980 980 980 203 980 980 980 980 203 203 98...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 583 583 583 583 821 583 583 821 821 583 821 583 583 583 821 583 821 821 821 583 821 583 583 821 821 821 821 583 583 583 821 583 821 821 821 821 821 821 583 821 583 583 821 583 821 583 583 583 821 821 583 821 821 821 583 821 583 821 821 583 821 583 821 583 583 583 583 583 821 583 583 583 583 583 58...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 326ms
memory: 3936kb

input:

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

output:

0 40 476 40 476 476 476 476 476 40 40 476 476 476 476 40 40 40 476 40 476 40 476 476 40 40 40 476 476 40 40 476 40 476 40 476 476 476 476 40 476 476 476 40 476 476 40 40 40 476 40 476 40 40 40 476 476 476 40 40 40 476 40 476 40 476 40 40 40 476 40 476 40 476 40 40 40 40 476 40 476 476 40 476 40 40 4...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 498 498 594 498 498 594 498 594 498 594 594 498 594 498 498 498 594 594 594 594 594 498 594 594 594 594 498 498 594 498 498 594 594 594 498 498 498 594 594 594 498 594 594 498 498 594 498 498 594 498 594 594 498 594 498 594 594 594 594 498 594 498 594 498 594 594 498 498 594 594 594 594 498 594 59...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 512 512 512 786 512 512 786 512 512 512 786 786 512 512 786 786 512 786 786 512 512 512 512 512 512 512 786 512 786 512 786 786 786 512 512 512 512 786 786 786 512 786 786 512 786 786 512 786 512 512 512 512 786 786 786 512 512 786 512 512 512 512 786 512 512 512 512 786 512 512 786 786 786 786 51...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 108 108 395 108 395 108 395 395 395 395 108 395 108 108 395 395 395 395 395 108 108 395 108 108 108 108 108 395 395 395 108 395 108 108 395 108 108 395 395 395 395 395 395 395 395 395 395 395 108 395 395 108 395 108 395 108 395 395 108 395 395 108 108 108 108 395 395 108 395 395 395 108 108 395 10...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed