QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#80481 | #2637. Factor-Free Tree | OtoriEmu | AC ✓ | 1203ms | 169708kb | C++14 | 2.1kb | 2023-02-23 22:11:43 | 2023-02-23 22:12:00 |
Judging History
answer
/*
¤ï¤ó¤ï¤ó¡¡¤ï¤ó¤À¤Û©`¤¤¤Ã¡î
Wonderhoy!
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double DB;
char buf[1<<21],*p1=buf,*p2=buf;
#define getchar() (p1==p2 && (p2=(p1=buf)+fread(buf,1,1<<18,stdin),p1==p2)?EOF:*p1++)
int read()
{
int x=0;
char c=getchar();
while(c<'0' || c>'9') c=getchar();
while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0'),c=getchar();
return x;
}
void write(int x)
{
if(x>9) write(x/10);
putchar(x%10+'0');
}
typedef pair<int,int> P;
typedef vector<int> Poly;
typedef vector<P> PolyP;
#define mp make_pair
#define spc putchar(' ')
#define etr putchar('\n')
#define inlp(x,y) putchar(x==y?'\n':' ')
int prime[3000005],cnt;
int mnp[10000005],mnpw[10000005];
bool vis[10000005];
void shai(int up)
{
vis[1]=true;
for(int i=2;i<=up;++i)
{
if(!vis[i]) prime[++cnt]=mnp[i]=mnpw[i]=i;
for(int j=1;j<=cnt && prime[j]*i<=up;++j)
{
if(!vis[prime[j]*i]) mnp[prime[j]*i]=prime[j];
vis[prime[j]*i]=true;
if(i%prime[j]==0)
{
mnpw[i*prime[j]]=mnpw[i]*prime[j];
break;
}
mnpw[i*prime[j]]=prime[j];
}
}
}
int n;
int a[1000005];
int ap[10000005];
int L[1000005],R[1000005];
int fa[1000005];
vector<int> G[1000005];
int Solve(int l,int r)
{
if(l>r) return 0;
if(l==r) return l;
int rt=-1;
for(int i=l,j=r;i<=j;++i,--j)
{
if(L[i]<l && r<R[i])
{
rt=i;
break;
}
if(L[j]<l && r<R[j])
{
rt=j;
break;
}
}
if(rt==-1) exit(puts("impossible")&0);
int u=Solve(l,rt-1),v=Solve(rt+1,r);
fa[u]=fa[v]=rt;
return rt;
}
int main(){
// freopen("1.in","r",stdin);
n=read();
for(int i=1;i<=n;++i) a[i]=read();
shai(*max_element(a+1,a+1+n));
for(int i=1;i<=n;++i)
{
int w=a[i];
while(w^1)
{
int p=mnp[w];
L[i]=max(L[i],ap[p]);
ap[p]=i;
w/=mnpw[w];
}
}
for(int i=1;i<=1e7;++i) ap[i]=n+1;
for(int i=n;i;--i)
{
R[i]=n+1;
int w=a[i];
while(w^1)
{
int p=mnp[w];
R[i]=min(R[i],ap[p]);
ap[p]=i;
w/=mnpw[w];
}
}
Solve(1,n);
for(int i=1;i<=n;++i) write(fa[i]),inlp(i,n);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 75ms
memory: 90648kb
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 10 2 3 4 5 6 7 8 1 10 11 12 13 14 15 16 17 999895 25 20 21 22 23 31 25 26 27 28 29 41 36 32 33 34 31 36 37 38 39 999880 49 42 43 44 45 46 47 57 49 50 51 52 53 54 55 41 63 58 59 60 61 69 63 64 65 66 67 57 86 78 71 72 73 74 75 76 70 78 79 80 81 82 83 84 69 101 94 88 89 90 91 92 87 94 95 96 97 98 99...
result:
ok
Test #2:
score: 0
Accepted
time: 16ms
memory: 67620kb
input:
10 34033 56827 124799 25981 90371 129293 195581 175601 77867 102811
output:
0 1 2 3 4 5 6 7 8 9
result:
ok
Test #3:
score: 0
Accepted
time: 12ms
memory: 67644kb
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:
0 1 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
result:
ok
Test #4:
score: 0
Accepted
time: 17ms
memory: 67764kb
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:
0 1 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 59 985 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 91 89 91 92 93 94 95 96 97 98 99 100 101 1...
result:
ok
Test #5:
score: 0
Accepted
time: 20ms
memory: 68124kb
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 0 2 5 3 5 6 10 8 7 13 11 10 13 14 15 18 16 18 19 20 24 22 21 24 27 25 27 28 29 36 31 32 33 34 9903 38 36 40 38 40 41 44 42 46 44 48 46 50 48 50 53 51 53 57 55 54 57 58 59 60 63 61 66 64 63 66 67 68 69 72 70 72 73 77 75 74 77 78 79 80 81 85 83 82 85 86 89 87 89 92 90 92 96 94 93 101 97 98 99 96 104...
result:
ok
Test #6:
score: 0
Accepted
time: 23ms
memory: 70236kb
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:
351 1 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 ...
result:
ok
Test #7:
score: 0
Accepted
time: 8ms
memory: 65816kb
input:
1 1
output:
0
result:
ok
Test #8:
score: 0
Accepted
time: 196ms
memory: 156324kb
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: 17ms
memory: 65876kb
input:
13 2 3 2 5 7 5 11 5 7 5 2 3 2
output:
2 7 2 5 3 5 0 9 7 9 12 10 12
result:
ok
Test #10:
score: 0
Accepted
time: 8ms
memory: 69212kb
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:
3 1 49980 6 4 49974 9 7 6 12 10 49968 15 13 12 18 16 15 21 19 18 24 22 49959 27 25 24 30 28 27 33 31 30 36 34 49950 39 37 36 42 40 49944 45 43 42 48 46 49941 51 49 49935 54 52 51 57 55 49926 60 58 57 63 61 49923 66 64 63 69 67 66 72 70 69 75 73 72 78 76 75 81 79 78 84 82 81 87 85 84 90 88 87 93 91 9...
result:
ok
Test #11:
score: 0
Accepted
time: 15ms
memory: 65828kb
input:
6 2 7 15 8 9 5
output:
2 0 4 2 4 5
result:
ok
Test #12:
score: 0
Accepted
time: 12ms
memory: 69284kb
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 6 4 3 9 7 49971 12 10 49968 15 13 12 18 16 49962 21 19 18 24 22 49959 27 25 24 30 28 49938 33 31 49926 36 34 33 39 37 36 42 40 39 45 43 42 48 46 45 51 49 49914 54 52 51 57 55 49911 60 58 49905 63 61 49902 66 64 49899 69 67 49896 72 70 49887 75 73 72 78 76 49884 81 79 49881 84 82 49878 87 8...
result:
ok
Test #13:
score: 0
Accepted
time: 11ms
memory: 69024kb
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 18 15 16 11 8 49954 49943 29 25 23 22 25 26 27 21 49936 49928 49922 37 35 33 35 32 49906 49897 49888 49877 49870 48 45 43 45 46 42 58 55 52 54 52 50 49 55 56 49869 62 59 60 49868 49841 49826 49822 74 68 66 70 72 70 68 72 77 74 75 65 82 80 78 80 77 49813 88 86...
result:
ok
Test #14:
score: 0
Accepted
time: 11ms
memory: 68984kb
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 3 4 5 2 10 8 13 10 11 15 13 7 1 20 17 18 49959 30 23 21 25 27 25 29 27 23 49946 36 33 31 33 34 49945 47 40 38 37 42 46 44 42 44 40 49944 49937 52 49 50 48 60 56 54 53 58 56 58 62 60 49936 74 65 63 67 69 67 71 69 73 71 65 62 81 78 76 75 78 79 49935 49929 91 88 86 84 86 83 88 89 82 105 98 9...
result:
ok
Test #15:
score: 0
Accepted
time: 17ms
memory: 69176kb
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 27 25 21 17 49910 49896 49887 38 35 33 32 35 36 31 49878 49873 48 46 44 42 44 41 46 40 54 51 49 51 52 49872 62 60 58 56 58 55 60 49871 49855 71 69 67 65 67 64 69 63 49843 49836 88 77 75 74 79 87 81 83 81 85 83 79 85 77 7...
result:
ok
Test #16:
score: 0
Accepted
time: 298ms
memory: 161964kb
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:
3 1 199977 6 4 3 9 7 6 12 10 199965 15 13 199959 18 16 199956 21 19 199953 24 22 199941 27 25 199938 30 28 199926 33 31 30 36 34 199923 39 37 199920 42 40 39 45 43 42 48 46 45 51 49 199911 54 52 51 57 55 199908 60 58 199905 63 61 60 66 64 199899 69 67 199896 72 70 199884 75 73 199878 78 76 199875 81...
result:
ok
Test #17:
score: 0
Accepted
time: 395ms
memory: 169088kb
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 11 9 8 14 12 11 17 15 14 20 18 17 23 21 20 26 24 29997 29 27 26 32 30 29985 35 33 32 38 36 35 41 39 38 44 42 29982 47 45 29976 50 48 29967 53 51 50 56 54 29946 59 57 56 62 60 29943 65 63 29940 68 66 29931 71 69 68 74 72 71 77 75 29928 80 78 77 83 81 29925 86 84 29922 89 87 86...
result:
ok
Test #18:
score: 0
Accepted
time: 410ms
memory: 168916kb
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 29990 9 7 6 12 10 9 15 13 12 18 16 29984 21 19 18 24 22 21 27 25 24 30 28 27 33 31 30 36 34 33 39 37 36 42 40 29981 45 43 29978 48 46 29972 51 49 48 54 52 29969 57 55 29966 60 58 57 63 61 60 66 64 29963 69 67 66 72 70 29948 75 73 29942 78 76 75 81 79 29939 84 82 29930 87 85 29924 90 88...
result:
ok
Test #19:
score: 0
Accepted
time: 410ms
memory: 169708kb
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 9 7 499980 12 10 499977 15 13 499974 18 16 15 21 19 499971 24 22 499968 27 25 24 30 28 27 33 31 30 36 34 499965 39 37 499962 42 40 499959 45 43 499956 48 46 499953 51 49 48 54 52 499950 57 55 54 60 58 499944 63 61 60 66 64 499935 69 67 66 72 70 69 75 73 499932 78 76 499929 81 79 499923 8...
result:
ok
Test #20:
score: 0
Accepted
time: 4ms
memory: 69224kb
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 12 10 49962 15 13 12 18 16 15 21 19 49959 24 22 21 27 25 49956 30 28 49953 33 31 30 36 34 33 39 37 49947 42 40 49944 45 43 42 48 46 49941 51 49 49932 54 52 49929 57 55 49920 60 58 57 63 61 49917 66 64 63 69 67 66 72 70 69 75 73 72 78 76 49914 81 79 49896 84 82 81 87 85 4989...
result:
ok
Test #21:
score: 0
Accepted
time: 8ms
memory: 65760kb
input:
6 2 7 15 8 9 6
output:
impossible
result:
ok
Test #22:
score: 0
Accepted
time: 163ms
memory: 121152kb
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: 199ms
memory: 137892kb
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: 179ms
memory: 137896kb
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: 107ms
memory: 81828kb
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: 85ms
memory: 82492kb
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 995 8 993 10 8 12 991 14 12 16 14 18 16 20 18 22 987 24 985 26 983 28 26 30 981 32 30 34 32 36 979 38 36 40 38 42 40 44 42 46 44 48 46 50 48 52 977 54 52 56 973 58 971 60 58 62 969 64 62 66 64 68 965 70 961 72 70 74 957 76 74 78 953 80 951 82 949 84 82 86 943 88 86 90 939 92 90 94 92 96 ...
result:
ok
Test #27:
score: 0
Accepted
time: 114ms
memory: 87616kb
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 99 4 2 6 97 8 6 10 8 12 10 14 95 16 93 18 16 20 18 22 20 24 89 26 24 28 87 30 28 32 85 34 32 36 34 38 36 40 77 42 40 44 42 46 73 48 46 50 67 52 63 54 57 54 55 59 57 61 59 52 61 65 63 50 65 69 67 71 69 48 71 75 73 44 75 79 77 81 79 83 81 38 83 30 85 26 87 91 89 22 91 14 93 12 95 4 97 101 99 0 103 2...
result:
ok
Test #28:
score: 0
Accepted
time: 541ms
memory: 133184kb
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 0 4 696999 6 696997 8 696995 10 696993 12 696991 14 696989 16 696987 18 696985 20 696983 22 696981 24 696979 26 696977 28 696975 30 696973 32 696971 34 696969 36 696967 38 696965 40 696963 42 696961 44 696959 46 696957 48 696955 50 696953 52 696951 54 696949 56 696947 58 696945 60 696943 62 696941...
result:
ok
Test #29:
score: 0
Accepted
time: 194ms
memory: 137892kb
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 697017 4 697015 6 697013 8 697011 10 697009 12 697007 14 697005 16 697003 18 697001 20 696999 22 696997 24 696995 26 696993 28 696991 30 696989 32 696987 34 696985 36 696983 38 696981 40 696979 42 696977 44 696975 46 696973 48 696971 50 696969 52 696967 54 696965 56 696963 58 696961 60 696959 62 6...
result:
ok
Test #30:
score: 0
Accepted
time: 104ms
memory: 89236kb
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:
9 1 2 3 4 5 6 7 18 9 10 11 12 13 14 15 16 0 35 27 20 21 22 23 24 25 19 27 28 29 30 31 32 33 999985 52 44 37 38 39 40 41 42 36 44 45 46 47 48 49 50 999966 67 60 54 55 56 57 58 53 60 61 62 63 64 65 74 67 71 69 68 71 72 52 82 75 76 77 78 79 80 90 82 83 84 85 86 87 88 74 109 100 92 93 94 95 96 97 98 91 ...
result:
ok
Test #31:
score: 0
Accepted
time: 85ms
memory: 87308kb
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:
10 1 2 3 4 5 6 7 8 20 10 11 12 13 14 15 16 17 18 999973 37 29 22 23 24 25 26 27 21 29 30 31 32 33 34 35 45 41 38 39 37 41 42 43 999947 55 46 47 48 49 50 51 52 53 65 55 56 57 58 59 60 61 62 63 45 82 74 67 68 69 70 71 72 66 74 75 76 77 78 79 80 93 82 88 84 85 86 83 88 89 90 91 999915 102 94 95 96 97 9...
result:
ok
Test #32:
score: 0
Accepted
time: 96ms
memory: 86580kb
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 8 2 3 4 5 6 1 8 9 10 11 12 13 999982 25 16 17 18 19 20 21 22 23 35 25 26 27 28 29 30 31 32 33 999951 45 36 37 38 39 40 41 42 43 55 45 46 47 48 49 50 51 52 53 999929 61 56 57 58 59 67 61 62 63 64 65 55 86 77 69 70 71 72 73 74 75 68 77 78 79 80 81 82 83 84 999917 92 87 88 89 90 98 92 93 94 95 96 86...
result:
ok
Test #33:
score: 0
Accepted
time: 258ms
memory: 160876kb
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: 12ms
memory: 65876kb
input:
17 2 3 2 5 2 7 2 11 2 13 2 17 2 19 2 23 2
output:
2 0 4 2 6 4 8 6 10 8 12 10 14 12 16 14 16
result:
ok
Test #35:
score: 0
Accepted
time: 218ms
memory: 168204kb
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: 75ms
memory: 109048kb
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:
0 1 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 10...
result:
ok
Test #37:
score: 0
Accepted
time: 1203ms
memory: 168280kb
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