QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#131363#2637. Factor-Free TreeGuanYunchangAC ✓777ms474552kbC++204.1kb2023-07-27 00:25:482023-07-27 00:25:51

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 535ms
memory: 385472kb

input:

1000000
19 29 31 37 41 43 47 53 59 23 29 31 37 41 43 47 53 59 17 37 41 43 47 53 31 37 41 43 47 53 29 37 41 43 47 31 37 41 43 47 23 37 41 43 47 53 59 61 31 37 41 43 47 53 59 61 29 41 43 47 53 59 37 41 43 47 53 59 31 41 47 53 59 61 67 71 73 43 47 53 59 61 67 71 73 37 61 71 73 79 83 89 97 67 71 73 79 8...

output:

19 3 4 5 6 7 8 9 10 1 18 11 14 15 16 17 12 10 999895 21 22 23 24 25 31 27 28 29 30 25 41 33 34 35 36 31 38 39 40 36 999880 43 44 45 46 47 48 49 57 56 52 53 54 55 50 49 41 59 60 61 62 63 69 65 63 67 68 65 57 86 72 73 74 75 76 77 78 70 78 79 80 83 81 85 83 69 101 89 90 91 92 93 94 87 94 97 98 99 100 9...

result:

ok 

Test #2:

score: 0
Accepted
time: 79ms
memory: 369200kb

input:

10
34033 56827 124799 25981 90371 129293 195581 175601 77867 102811

output:

2 3 4 5 6 7 8 9 10 0 

result:

ok 

Test #3:

score: 0
Accepted
time: 83ms
memory: 365676kb

input:

100
4007 58067 87683 39181 1319 17659 105871 128981 112241 153733 98419 148867 162119 3877 28627 26681 10211 64591 146701 91183 192307 179119 81283 4729 65419 143197 37649 92567 48473 31277 182141 196991 17387 47491 183499 59107 61687 21323 160079 150401 16477 92809 182561 39113 151787 83557 173293 ...

output:

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 0 

result:

ok 

Test #4:

score: 0
Accepted
time: 73ms
memory: 366676kb

input:

1000
89417 156589 58309 7919 93497 100207 163981 176503 8887 69163 198823 102653 88609 13477 112603 94219 46831 34963 39113 190901 101723 121421 30553 51673 98129 17509 101021 28439 90023 16069 98299 66851 133321 587 154057 53381 67369 49277 1783 9109 7537 45137 32533 101627 137507 154789 29717 1386...

output:

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 59 57 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 91 89 92 93 94 95 96 97 98 99 100 101 102 10...

result:

ok 

Test #5:

score: 0
Accepted
time: 58ms
memory: 368436kb

input:

10000
53047 108499 32027 141353 17021 103067 91253 195259 43801 36451 24023 121067 185707 1361 69151 141131 37039 143873 166043 136861 155657 195739 106501 15973 10687 158699 148061 88919 156781 36677 52181 43133 118589 188603 41257 81799 21377 89897 43051 70921 65027 159569 197573 22709 20323 10453...

output:

2 3 5 3 6 7 10 7 8 13 10 11 14 15 16 18 16 19 20 21 24 21 22 25 27 25 28 29 30 36 30 33 35 33 31 38 36 40 38 41 42 44 42 46 44 48 46 50 48 53 50 51 54 57 56 54 58 59 60 61 63 61 66 65 63 67 68 69 70 72 70 73 74 77 74 75 78 79 80 81 82 85 82 83 86 87 89 87 90 92 90 93 96 93 94 101 98 99 100 96 104 10...

result:

ok 

Test #6:

score: 0
Accepted
time: 121ms
memory: 368572kb

input:

100000
194891 2719 191353 14731 5897 124561 134593 56479 129401 61547 88289 2683 66239 40591 105397 83921 178261 91631 23539 198829 93529 98347 173053 63073 124981 37549 195047 21059 131947 34469 52249 42509 142183 140683 43117 57791 49823 167861 11471 49523 107999 23833 187217 53003 161527 75571 70...

output:

2 3 4 7 6 4 62 9 11 9 15 13 14 11 7 17 20 19 17 54 24 21 22 28 27 25 24 30 28 34 32 30 32 20 42 37 38 39 35 39 40 34 45 43 46 47 49 47 42 51 49 53 51 15 56 61 58 59 56 59 54 109 64 66 64 74 68 66 70 72 70 68 72 78 77 75 74 62 85 81 82 79 82 83 89 87 85 87 94 93 90 91 89 96 94 78 106 105 103 102 100 ...

result:

ok 

Test #7:

score: 0
Accepted
time: 64ms
memory: 366960kb

input:

1
1

output:

0 

result:

ok 

Test #8:

score: 0
Accepted
time: 77ms
memory: 368848kb

input:

1000
3297617 3913837 1136897 3348581 323083 1900463 933931 4455221 504857 7477979 8972191 8565031 5216683 5933461 8936357 5464573 4607719 3821791 79537 5023471 4323611 3215039 305479 5544421 1129729 7893533 572683 5444237 8669237 8296627 592931 5292361 7848089 5677057 4641907 1270943 7611047 9740611...

output:

impossible

result:

ok 

Test #9:

score: 0
Accepted
time: 71ms
memory: 367140kb

input:

13
2 3 2 5 7 5 11 5 7 5 2 3 2

output:

2 7 2 5 3 5 0 9 12 9 10 7 12 

result:

ok 

Test #10:

score: 0
Accepted
time: 103ms
memory: 368736kb

input:

49982
157273 19777 49369 134161 140401 161059 155887 140401 134161 46993 58757 136343 140893 58757 46993 140893 181081 58757 181081 106297 140893 53629 122033 34313 122033 8779 53629 180623 8779 122033 180623 41521 8779 92941 3407 92737 187177 92941 3407 111827 22901 51001 172561 22901 111827 19919 ...

output:

2 3 49980 6 4 49974 8 9 6 12 10 49968 14 15 12 18 16 15 21 19 18 24 22 49959 27 25 24 29 30 27 33 31 30 35 36 49950 38 39 36 42 40 49944 44 45 42 47 48 49941 50 51 49935 53 54 51 56 57 49926 60 58 57 63 61 49923 66 64 63 69 67 66 71 72 69 74 75 72 77 78 75 81 79 78 84 82 81 86 87 84 90 88 87 92 93 9...

result:

ok 

Test #11:

score: 0
Accepted
time: 78ms
memory: 366824kb

input:

6
2 7 15 8 9 5

output:

2 0 4 2 6 4 

result:

ok 

Test #12:

score: 0
Accepted
time: 98ms
memory: 367976kb

input:

49982
153749 164771 156007 161159 164771 153749 701 80923 79367 176549 77509 701 77509 367 176549 16063 182099 31799 16063 6691 182099 183059 138683 6691 126311 183059 138683 48649 151507 184463 47933 23311 48757 19031 47933 23311 19031 112771 47933 156157 112771 19031 156157 138251 112771 161947 13...

output:

3 1 49980 5 6 3 8 9 49971 12 10 49968 15 13 12 17 18 49962 21 19 18 23 24 49959 26 27 24 30 28 49938 32 33 49926 35 36 33 39 37 36 41 42 39 45 43 42 47 48 45 51 49 49914 54 52 51 56 57 49911 59 60 49905 63 61 49902 66 64 49899 69 67 49896 72 70 49887 74 75 72 77 78 49884 81 79 49881 83 84 49878 86 8...

result:

ok 

Test #13:

score: 0
Accepted
time: 93ms
memory: 366648kb

input:

49982
183871 116041 4639 28393 4639 116041 132859 116041 117539 68659 149239 55927 103963 55927 68659 55927 103963 117539 4639 117539 68659 55927 113171 121571 66533 177953 121571 113171 55213 113171 121571 104399 141439 14741 56333 14741 97879 14741 199 144941 61687 185873 168083 130261 115603 1142...

output:

7 4 2 1 4 5 49973 49968 11 9 19 13 15 13 11 17 15 17 8 49954 49943 29 25 23 26 22 26 27 21 49936 49928 49922 37 35 33 35 32 49906 49897 49888 49877 49870 48 45 43 45 46 42 58 54 52 50 52 49 54 55 56 48 62 59 60 58 49841 49826 49822 74 68 66 70 72 70 68 72 77 74 75 65 82 80 78 80 77 49813 88 86 84 86...

result:

ok 

Test #14:

score: 0
Accepted
time: 88ms
memory: 368200kb

input:

49982
21143 129641 142873 20431 143827 37489 77489 143827 20431 98387 20431 143827 37489 20431 142873 143257 142873 37489 20431 98387 37489 77489 109397 145967 115153 145967 165133 115153 77489 143827 77489 115153 109397 145967 115153 165133 115153 109397 142453 121621 149143 142453 136093 149143 13...

output:

49960 16 7 6 4 3 2 10 8 7 12 10 14 12 14 1 20 19 17 16 30 23 27 25 23 25 21 27 28 49946 36 33 34 31 34 30 47 40 38 37 42 40 44 42 44 45 36 49937 52 49 50 48 56 53 54 62 58 60 58 56 60 52 74 65 63 67 69 67 71 69 65 71 72 62 81 78 76 75 78 79 49935 49929 91 88 86 84 86 83 88 89 82 105 98 95 93 95 96 9...

result:

ok 

Test #15:

score: 0
Accepted
time: 89ms
memory: 366624kb

input:

49982
65381 87257 148997 95569 159499 91249 159499 95569 54413 95569 159499 175979 121493 192043 99809 121493 168211 121493 99809 104471 172673 128621 165437 128621 104471 165437 99809 192043 99809 104471 128621 21101 179563 183167 149111 183167 179563 112067 179563 183167 199679 101111 5531 74923 5...

output:

49961 49953 9 6 4 3 6 7 2 49938 49924 49920 14 17 14 15 12 28 21 19 18 23 25 23 21 25 26 17 49910 49896 49887 38 35 33 32 35 36 31 49878 49873 48 44 42 41 46 44 46 40 54 51 52 49 52 48 62 58 56 55 60 58 60 49871 49855 71 67 65 64 69 67 69 63 49843 49836 88 77 75 74 79 77 81 83 81 85 83 79 85 86 73 4...

result:

ok 

Test #16:

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

input:

199982
8822797 2017831 8092661 5518399 8822797 2017831 5518399 9660557 8822797 4873903 9562589 2518121 7176457 2052187 3999971 7470457 7254319 2052187 2933753 3522653 7470457 5930887 8339677 5675491 7468999 7600613 8339677 2693443 3477263 6769181 2693443 3473611 3477263 4743587 8741347 3473611 38051...

output:

2 3 199977 5 6 3 9 7 6 11 12 199965 15 13 199959 17 18 199956 21 19 199953 24 22 199941 26 27 199938 29 30 199926 33 31 30 35 36 199923 39 37 199920 42 40 39 44 45 42 47 48 45 51 49 199911 53 54 51 57 55 199908 59 60 199905 63 61 60 65 66 199899 68 69 199896 71 72 199884 75 73 199878 77 78 199875 81...

result:

ok 

Test #17:

score: 0
Accepted
time: 409ms
memory: 382256kb

input:

499982
7008569 7583963 383963 1194059 4307741 1194059 9541871 383963 4078883 9541871 1194059 4078883 5363461 9541871 5192167 5363461 4078883 5192167 9629063 5363461 1997243 9629063 5192167 9203729 3379049 1997243 9203729 5238421 3379049 9797807 865807 8148229 5662169 9797807 865807 131101 5662169 97...

output:

30004 30000 5 3 2 8 6 5 10 11 8 14 12 11 16 17 14 20 18 17 22 23 20 25 26 29997 29 27 26 31 32 29985 34 35 32 37 38 35 41 39 38 44 42 29982 47 45 29976 50 48 29967 52 53 50 55 56 29946 58 59 56 61 62 29943 65 63 29940 68 66 29931 70 71 68 74 72 71 77 75 29928 79 80 77 83 81 29925 86 84 29922 89 87 8...

result:

ok 

Test #18:

score: 0
Accepted
time: 412ms
memory: 382288kb

input:

499982
2852963 1799107 4868233 1621637 9713947 1644421 2105921 9713947 1621637 2105921 2502293 9713947 2502293 6517543 2105921 5304263 8478671 9964979 5304263 8263169 8478671 216037 8263169 5304263 216037 6113453 8263169 4307323 6113453 216037 4307323 7347983 6113453 1493207 7347983 4307323 8378369 ...

output:

3 1 30003 6 4 14856 8 9 6 12 10 9 15 13 12 17 18 15 21 19 18 23 24 21 27 25 24 29 30 27 33 31 30 35 36 33 38 39 36 42 40 39 44 45 42 48 46 45 50 51 48 54 52 51 57 55 54 59 60 57 63 61 60 65 66 63 68 69 66 71 72 69 74 75 72 77 78 75 81 79 78 84 82 81 87 85 84 90 88 87 93 91 90 95 96 93 99 97 96 101 1...

result:

ok 

Test #19:

score: 0
Accepted
time: 462ms
memory: 385896kb

input:

499982
8222183 7306531 5659859 7306531 8781709 8222183 9018617 7510879 8781709 2169203 4679911 9018617 8301169 3324203 4679911 8753663 3324203 8301169 5029907 9590767 8753663 2524393 8463877 9590767 2524393 2344033 8463877 5087237 2344033 2524393 3922741 5087237 2344033 505613 5407639 3922741 991777...

output:

3 1 0 6 4 3 8 9 499980 12 10 499977 15 13 499974 17 18 15 21 19 499971 23 24 499968 27 25 24 29 30 27 32 33 30 36 34 499965 38 39 499962 42 40 499959 44 45 499956 47 48 499953 50 51 48 53 54 499950 57 55 54 59 60 499944 62 63 60 66 64 499935 69 67 66 71 72 69 75 73 499932 77 78 499929 81 79 499923 8...

result:

ok 

Test #20:

score: 0
Accepted
time: 91ms
memory: 368240kb

input:

49982
12269 119299 86539 119299 64123 12269 85549 23333 93241 108877 119557 95107 108877 20441 119557 173819 20441 108877 53281 27827 173819 53281 128239 27827 113489 113969 128239 122279 138889 113489 138899 138889 122279 138899 104549 138889 169987 145259 194083 48619 39733 169987 39733 187871 486...

output:

3 1 49980 6 4 3 9 7 49974 11 12 49962 15 13 12 17 18 15 20 21 49959 24 22 21 26 27 49956 30 28 49953 32 33 30 36 34 33 38 39 49947 42 40 49944 45 43 42 47 48 49941 51 49 49932 53 54 49929 57 55 49920 60 58 57 62 63 49917 66 64 63 69 67 66 71 72 69 74 75 72 78 76 49914 81 79 49896 84 82 81 86 87 4989...

result:

ok 

Test #21:

score: 0
Accepted
time: 75ms
memory: 366132kb

input:

6
2 7 15 8 9 6

output:

impossible

result:

ok 

Test #22:

score: 0
Accepted
time: 692ms
memory: 400148kb

input:

999995
5 3 11 7 17 13 23 19 31 29 41 37 47 43 59 53 67 61 73 71 83 79 97 89 103 101 109 107 127 113 137 131 149 139 157 151 167 163 179 173 191 181 197 193 211 199 227 223 233 229 241 239 257 251 269 263 277 271 283 281 307 293 313 311 331 317 347 337 353 349 367 359 379 373 389 383 401 397 419 409 ...

output:

2 499998 4 499996 6 499994 8 499992 10 499990 12 499988 14 499986 16 499984 18 499982 20 499980 22 499978 24 499976 26 499974 28 499972 30 499970 32 499968 34 499966 36 499964 38 499962 40 499960 42 499958 44 499956 46 499954 48 499952 50 499950 52 499948 54 499946 56 499944 58 499942 60 499940 62 4...

result:

ok 

Test #23:

score: 0
Accepted
time: 763ms
memory: 408012kb

input:

999999
5 3 11 7 17 13 23 19 31 29 41 37 47 43 59 53 67 61 73 71 83 79 97 89 103 101 109 107 127 113 137 131 149 139 157 151 167 163 179 173 191 181 197 193 211 199 227 223 233 229 241 239 257 251 269 263 277 271 283 281 307 293 313 311 331 317 347 337 353 349 367 359 379 373 389 383 401 397 419 409 ...

output:

2 697002 4 697000 6 696998 8 696996 10 696994 12 696992 14 696990 16 696988 18 696986 20 696984 22 696982 24 696980 26 696978 28 696976 30 696974 32 696972 34 696970 36 696968 38 696966 40 696964 42 696962 44 696960 46 696958 48 696956 50 696954 52 696952 54 696950 56 696948 58 696946 60 696944 62 6...

result:

ok 

Test #24:

score: 0
Accepted
time: 777ms
memory: 407904kb

input:

999999
3 2 7 5 13 11 19 17 29 23 37 31 43 41 53 47 61 59 71 67 79 73 89 83 101 97 107 103 113 109 131 127 139 137 151 149 163 157 173 167 181 179 193 191 199 197 223 211 229 227 239 233 251 241 263 257 271 269 281 277 293 283 311 307 317 313 337 331 349 347 359 353 373 367 383 379 397 389 409 401 42...

output:

2 0 4 999998 6 999996 8 999994 10 999992 12 999990 14 999988 16 999986 18 999984 20 999982 22 999980 24 999978 26 999976 28 999974 30 999972 32 999970 34 999968 36 999966 38 999964 40 999962 42 999960 44 999958 46 999956 48 999954 50 999952 52 999950 54 999948 56 999946 58 999944 60 999942 62 999940...

result:

ok 

Test #25:

score: 0
Accepted
time: 516ms
memory: 380836kb

input:

1000000
11 7 17 13 19 17 23 19 31 29 37 31 43 41 47 43 53 47 59 53 61 59 67 61 71 67 73 71 79 73 83 79 97 89 113 109 127 113 137 131 139 137 151 149 157 151 163 157 167 163 173 167 191 181 197 193 199 197 211 199 229 227 241 239 241 233 239 229 233 223 227 211 223 191 193 179 181 173 179 139 149 127...

output:

2 100 4 98 6 4 8 6 10 96 12 10 14 94 16 14 18 16 20 18 22 20 24 22 26 24 28 26 30 28 32 30 34 92 36 84 38 36 40 82 42 40 44 80 46 44 48 46 50 48 52 50 54 76 56 74 58 56 60 58 62 70 64 66 64 68 66 62 68 72 70 60 72 54 74 78 76 52 78 42 80 38 82 86 84 88 86 90 88 34 90 32 92 12 94 8 96 2 98 9900 102 1...

result:

ok 

Test #26:

score: 0
Accepted
time: 527ms
memory: 381236kb

input:

1000000
11 7 13 11 23 19 31 29 37 31 43 41 47 43 53 47 59 53 61 59 73 71 83 79 97 89 101 97 107 103 109 107 113 109 131 127 137 131 139 137 149 139 151 149 157 151 163 157 167 163 179 173 181 179 197 193 211 199 223 211 229 227 233 229 239 233 257 251 271 269 277 271 293 283 307 293 317 313 337 331 ...

output:

2 999 4 2 6 517 8 6 10 8 12 10 14 12 16 14 18 16 20 18 22 20 24 22 26 24 28 26 30 28 32 30 34 32 36 34 38 36 40 38 42 40 44 42 46 44 48 46 50 48 52 50 54 52 56 54 58 56 60 58 62 60 64 62 66 64 68 66 70 68 72 70 74 72 76 74 78 76 80 78 82 80 84 82 86 84 88 86 90 88 92 90 94 92 96 94 98 96 100 98 102 ...

result:

ok 

Test #27:

score: 0
Accepted
time: 538ms
memory: 384012kb

input:

1000000
7 5 11 7 17 13 19 17 23 19 29 23 37 31 43 41 47 43 53 47 59 53 71 67 73 71 83 79 89 83 101 97 103 101 107 103 109 107 139 137 149 139 151 149 167 163 173 167 193 191 211 199 233 229 239 233 227 229 223 227 211 223 197 199 193 197 181 191 179 181 173 179 157 163 151 157 131 137 127 131 113 12...

output:

2 55 4 2 6 4 8 6 10 8 12 10 14 12 16 14 18 16 20 18 22 20 24 22 26 24 28 26 30 28 32 30 34 32 36 34 38 36 40 38 42 40 44 42 46 44 48 46 50 48 52 50 54 52 99 58 56 65 60 58 62 60 64 62 68 65 66 71 70 68 75 71 74 72 83 75 78 76 80 78 82 80 93 83 86 84 86 87 90 88 90 91 97 93 96 94 55 97 101 99 0 103 2...

result:

ok 

Test #28:

score: 0
Accepted
time: 708ms
memory: 419524kb

input:

697000
1429573 2533837 4275511 2210743 166363 4865969 2587103 1946947 404119 344189 4860517 3676103 3600187 2318761 2497457 1754491 4102493 186437 2065169 4627031 146213 3740197 1563431 4475459 1561457 1866721 1356461 2405773 4716913 4317919 4159979 1726003 8117 974033 1747043 696083 1858733 1587997...

output:

2 348502 4 2 6 4 8 6 10 8 12 10 14 12 16 14 18 16 20 18 22 20 24 22 26 24 28 26 30 28 32 30 34 32 36 34 38 36 40 38 42 40 44 42 46 44 48 46 50 48 52 50 54 52 56 54 58 56 60 58 62 60 64 62 66 64 68 66 70 68 72 70 74 72 76 74 78 76 80 78 82 80 84 82 86 84 88 86 90 88 92 90 94 92 96 94 98 96 100 98 102...

result:

ok 

Test #29:

score: 0
Accepted
time: 751ms
memory: 410100kb

input:

1000000
13 11 19 17 29 23 37 31 43 41 53 47 61 59 71 67 79 73 89 83 101 97 107 103 113 109 131 127 139 137 151 149 163 157 173 167 181 179 193 191 199 197 223 211 229 227 239 233 251 241 263 257 271 269 281 277 293 283 311 307 317 313 337 331 349 347 359 353 373 367 383 379 397 389 409 401 421 419 4...

output:

2 348510 4 2 6 4 8 6 10 8 12 10 14 12 16 14 18 16 20 18 22 20 24 22 26 24 28 26 30 28 32 30 34 32 36 34 38 36 40 38 42 40 44 42 46 44 48 46 50 48 52 50 54 52 56 54 58 56 60 58 62 60 64 62 66 64 68 66 70 68 72 70 74 72 76 74 78 76 80 78 82 80 84 82 86 84 88 86 90 88 92 90 94 92 96 94 98 96 100 98 102...

result:

ok 

Test #30:

score: 0
Accepted
time: 553ms
memory: 384796kb

input:

1000000
5 7 11 13 17 19 23 29 3 5 7 11 13 17 19 23 29 2 7 13 17 19 23 29 31 37 11 13 17 19 23 29 31 37 5 13 19 23 29 31 37 41 43 17 19 23 29 31 37 41 43 11 19 29 31 37 41 43 47 23 29 31 37 41 43 47 17 19 29 31 23 29 31 13 23 29 31 37 41 43 47 19 23 29 31 37 41 43 47 17 23 31 37 41 43 47 53 59 61 29 ...

output:

2 3 4 5 6 7 8 9 18 9 12 10 14 15 16 17 12 0 35 21 22 23 24 25 26 27 19 29 27 31 32 33 34 29 999985 52 38 39 40 41 42 43 44 36 46 44 48 49 50 51 46 999966 60 55 56 57 58 59 53 67 62 63 64 65 66 60 74 67 70 71 68 73 71 52 76 77 78 79 80 81 82 90 84 82 86 87 88 89 84 74 109 93 94 95 96 97 98 99 100 91 ...

result:

ok 

Test #31:

score: 0
Accepted
time: 496ms
memory: 383796kb

input:

1000000
7 11 13 17 19 23 29 31 37 5 7 11 13 17 19 23 29 31 37 3 13 19 23 29 31 37 41 43 17 19 23 29 31 37 41 43 11 17 19 23 13 17 19 23 7 17 19 23 29 31 37 41 43 47 13 17 19 23 29 31 37 41 43 47 11 23 31 37 41 43 47 53 59 29 31 37 41 43 47 53 59 19 23 31 37 41 43 29 31 37 41 43 17 29 31 37 41 43 47 ...

output:

2 3 4 5 6 7 8 9 10 20 10 11 14 12 16 17 18 19 14 999973 37 23 24 25 26 27 28 29 21 31 32 33 34 35 36 29 45 39 40 41 37 43 44 41 999947 47 48 49 50 51 52 53 54 55 65 55 56 59 57 61 62 63 64 59 45 74 68 69 70 71 72 73 66 82 76 77 78 79 80 81 74 93 82 85 86 87 88 83 90 91 92 88 999915 95 96 97 98 99 10...

result:

ok 

Test #32:

score: 0
Accepted
time: 510ms
memory: 383428kb

input:

1000000
5 11 13 17 19 23 29 7 11 13 17 19 23 29 3 17 19 23 29 31 37 41 43 47 13 17 19 23 29 31 37 41 43 47 11 23 29 31 37 41 43 47 53 59 19 23 29 31 37 41 43 47 53 59 17 29 31 37 41 43 23 29 31 37 41 43 19 31 41 43 47 53 59 61 67 71 37 41 43 47 53 59 61 67 71 29 41 43 47 53 59 37 41 43 47 53 59 31 4...

output:

15 3 4 5 6 7 8 1 8 9 12 13 14 10 999982 17 18 19 20 21 22 23 24 25 35 25 26 29 30 31 32 33 34 27 999951 37 38 39 40 41 42 43 44 45 55 52 48 49 50 51 46 53 54 45 999929 57 58 59 60 61 67 61 64 62 66 64 55 86 70 71 72 73 74 75 76 77 68 79 80 81 82 83 84 85 77 999917 88 89 90 91 92 98 92 95 93 97 95 86...

result:

ok 

Test #33:

score: 0
Accepted
time: 180ms
memory: 379328kb

input:

100000
9982067 8227273 2712587 1623781 7338031 8046817 5823971 2648963 5255423 581891 9889079 3918149 1056019 5741149 4011769 8142467 146683 8752427 7511167 2314373 1084939 4214909 2464981 349589 4836151 3852547 9260681 6244607 8236219 8098933 5918243 7857401 7174927 4890013 917837 142097 4167017 61...

output:

impossible

result:

ok 

Test #34:

score: 0
Accepted
time: 84ms
memory: 367132kb

input:

17
2 3 2 5 2 7 2 11 2 13 2 17 2 19 2 23 2

output:

2 4 2 6 4 8 6 10 8 12 10 14 12 16 14 0 16 

result:

ok 

Test #35:

score: 0
Accepted
time: 133ms
memory: 376712kb

input:

1000000
9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999991 9999...

output:

impossible

result:

ok 

Test #36:

score: 0
Accepted
time: 477ms
memory: 474552kb

input:

1000000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...

result:

ok 

Test #37:

score: 0
Accepted
time: 604ms
memory: 419088kb

input:

1000000
9247079 9172396 9769325 9607384 9288473 9882987 9496045 9060317 9230135 9714408 9618694 9868580 9626003 9030706 9350016 9191938 9589335 9825768 9006378 9920054 9005991 9013550 9118281 9009223 9629157 9217226 9532784 9349996 9303575 9899522 9463228 9043977 9650851 9357992 9548765 9918229 9905...

output:

impossible

result:

ok