QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#609745#9432. Permutationucup-team3746AC ✓240ms3944kbC++233.3kb2024-10-04 13:52:262024-10-04 13:52:27

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
1
1
0
2
1
1
0
2
0

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 983 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #3:

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

input:

1
1

output:

0 1
1 1

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
1
1
0
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
0
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 356 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 798 318 730 409 782 70 147 576 550 355 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 356 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 798 318 730 409 782 70 147 576 550 355 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 356 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 355 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 356 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 355 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 356 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 983 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 984 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 983 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 231ms
memory: 3736kb

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 984 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 983 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 984 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 231ms
memory: 3932kb

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 983 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 218ms
memory: 3944kb

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 984 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 233ms
memory: 3736kb

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 983 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 984 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 983 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 483 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 984 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 983 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 997 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 984 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 269 256 273 955 566 473 557 295 388 422 440 921 177 342 329 43 926 519 895 79 956 77 836 506 662 402 367 78 364 42 24 146 974 27 888 636 466 18 447 316 312 405 253 523 13 852 950 157 17 449 592 980 318 730 409 782 70 147 576 550 983 231 738 902 487 340 551 547 219 603 648 866 205 580 726 484 794 1...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 699 701 274 956 681 474 558 296 312 753 344 967 865 755 330 44 560 520 896 449 963 295 682 157 957 635 368 405 22 997 6 819 16 26 214 337 388 42 116 765 275 739 254 524 429 107 322 158 259 450 414 309 48 179 785 11 955 148 167 3 984 232 562 400 869 18 552 548 939 604 713 656 357 412 382 98 925 215...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed