QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#422983 | #8364. permutation | Diu | 100 ✓ | 699ms | 22016kb | C++14 | 1.9kb | 2024-05-27 20:40:39 | 2024-05-27 20:40:41 |
Judging History
answer
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
const int N=4e5+10;
int n,m,fac[10],p[10],q[10],st[10],s[N],f[N][10];
int make_hsh(int *p){
int s=0;
for(int i=1;i<=n;i++){
int res=p[i]-1;
for(int j=1;j<i;j++)if(p[j]<p[i])--res;
s+=res*fac[n-i];
}
return s;
}
bool vis[10];
void get_hsh(int s){
for(int i=1;i<=n;i++)vis[i]=0;
for(int i=1;i<=n;i++){
int x=s/fac[n-i]+1;s%=fac[n-i];
for(int j=1;j<=n;j++){
if(vis[j])continue;
--x;
if(!x){
vis[j]=1,p[i]=j;
break;
}
}
}
}
inline char nc(){
static char buf[1000010],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000010,stdin),p1==p2)?EOF:*p1++;
}
inline int read(){
register int s=0,w=0;
static char ch=nc();
for(;!isdigit(ch);)ch=nc(),w^=ch=='-';
for(;isdigit(ch);)s=(s<<1)+(s<<3)+(ch^48),ch=nc();
return w?-s:s;
}
signed main(){
n=read(),m=read();
fac[0]=1;
for(int i=1;i<=n;i++)fac[i]=fac[i-1]*i;
for(int i=1;i<=m;i++){
for(int i=1;i<=n;i++)p[i]=read();
s[i]=make_hsh(p);
// get_hsh(s[i]);
// printf("%d\n",s[i]);
// for(int i=1;i<=n;i++)printf("%d ",p[i]);puts("");
++f[s[i]][n];
}
for(int j=n;j>0;j--){
for(int i=0;i<fac[n];i++){
if(!f[i][j])continue;
get_hsh(i);
// printf("DP:%d\n",i);
// for(int w=1;w<=n;w++)printf("%d ",p[w]);puts("");
int id;for(int k=1;k<=n;k++)if(p[k]==j){id=k;break;}
int tp=0;
for(int k=id;k<=n;k++){
if(p[k]>j)continue;
while(tp&&p[st[tp]]<p[k])--tp;
st[++tp]=k;
// printf("ST:%d %d %d\n",id,k,tp);
// for(int l=1;l<=tp;l++)printf("%d ",st[l]);puts("");
for(int l=1;l<=n;l++)q[l]=p[l];
for(int l=2;l<=tp;l++)swap(q[st[l-1]],q[st[l]]);
int s=make_hsh(q);
f[s][j-1]+=f[i][j];
// for(int l=1;l<=n;l++)printf("%d ",q[l]);puts("");
}
}
}
for(int i=1;i<=m;i++)printf("%d\n",f[s[i]][0]);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 6ms
memory: 8292kb
input:
7 2000 5 1 7 4 6 3 2 1 4 6 3 5 2 7 1 3 4 6 2 7 5 6 3 7 1 4 5 2 7 3 6 2 4 1 5 6 7 3 4 1 2 5 6 1 2 5 7 4 3 5 1 4 3 7 6 2 5 3 4 1 2 7 6 7 1 3 4 6 5 2 7 4 6 2 5 1 3 2 6 3 4 1 7 5 5 6 3 1 2 4 7 4 1 6 7 5 3 2 2 6 1 3 7 4 5 1 6 2 3 4 5 7 4 3 1 5 2 7 6 7 3 2 5 4 6 1 2 6 7 1 5 3 4 7 6 2 4 1 5 3 5 1 7 3 6 2 4...
output:
57 658 1058 53 25 22 160 201 296 78 16 425 162 88 520 1032 615 31 110 14 136 176 3 203 52 38 523 384 491 178 531 8 84 589 22 89 58 119 468 120 20 224 311 69 6 1015 10 25 254 52 374 916 1 11 380 19 1094 550 769 56 49 357 735 319 17 31 741 26 62 158 75 147 31 311 438 136 396 83 53 37 141 99 247 837 60...
result:
ok 2000 numbers
Test #2:
score: 0
Accepted
time: 3ms
memory: 6360kb
input:
7 2000 2 1 7 5 6 4 3 4 7 3 1 6 2 5 3 6 4 5 2 1 7 6 5 2 7 3 1 4 4 7 3 5 1 6 2 1 2 4 5 6 3 7 5 1 3 4 7 2 6 5 6 4 2 1 7 3 7 6 3 1 4 2 5 6 7 1 2 3 5 4 2 7 3 5 6 4 1 1 4 5 2 6 3 7 6 7 1 5 3 4 2 4 1 7 6 3 2 5 2 6 7 4 5 3 1 5 7 3 6 4 2 1 4 5 2 6 1 7 3 4 2 3 1 6 7 5 7 5 3 1 2 4 6 3 1 7 6 5 2 4 3 4 5 1 2 7 6...
output:
217 108 128 29 50 1436 449 49 20 81 50 1085 18 195 21 2 197 620 42 176 522 456 30 11 43 144 90 462 1226 135 19 47 86 9 274 294 299 111 255 169 86 132 313 117 25 175 1 720 201 202 49 41 590 457 112 455 19 10 9 644 42 1382 945 308 11 71 26 109 205 16 37 7 99 190 251 79 50 723 28 62 44 50 173 220 730 6...
result:
ok 2000 numbers
Test #3:
score: 0
Accepted
time: 6ms
memory: 6004kb
input:
7 2000 3 2 7 6 4 5 1 6 1 2 7 3 4 5 7 2 4 6 3 5 1 3 1 2 7 4 5 6 6 7 2 1 5 3 4 1 4 5 2 6 7 3 1 3 4 7 5 2 6 7 2 3 6 4 5 1 7 3 2 4 1 5 6 5 3 7 2 6 4 1 3 4 6 7 2 1 5 3 1 6 5 4 2 7 3 5 6 7 1 2 4 4 7 2 5 6 3 1 7 1 5 3 4 6 2 2 6 4 5 7 3 1 3 2 6 4 7 5 1 4 3 5 6 2 7 1 2 5 4 1 3 6 7 6 5 7 1 3 4 2 6 7 5 4 1 2 3...
output:
70 284 26 876 48 695 706 31 100 38 117 646 116 28 69 74 149 81 824 28 8 68 123 126 351 185 338 44 87 49 854 840 149 622 155 46 80 1643 146 45 285 206 21 27 1084 13 720 1583 60 51 88 136 999 39 434 17 64 140 251 8 24 1243 157 70 61 180 140 648 116 155 749 338 272 5 630 1158 122 60 186 80 91 458 206 2...
result:
ok 2000 numbers
Test #4:
score: 0
Accepted
time: 3ms
memory: 6016kb
input:
7 2000 7 1 5 4 6 3 2 7 2 5 4 1 6 3 1 7 3 4 2 5 6 5 6 4 3 1 7 2 6 1 7 3 4 2 5 3 2 6 7 5 1 4 6 7 2 5 1 4 3 6 5 3 7 2 1 4 6 3 7 4 2 5 1 3 1 6 2 4 7 5 4 2 6 5 3 1 7 7 2 1 3 6 4 5 5 3 6 2 4 1 7 4 2 5 1 6 3 7 1 2 3 4 7 5 6 1 5 6 7 2 3 4 6 3 2 7 5 1 4 2 6 7 1 4 5 3 2 1 7 5 3 6 4 1 3 6 5 2 4 7 6 7 2 1 4 5 3...
output:
26 54 435 38 141 148 24 26 20 815 243 153 126 611 1432 217 68 161 453 934 46 289 1315 719 389 145 827 89 890 457 16 82 143 156 316 215 11 122 155 49 885 402 1171 103 47 851 336 1434 49 104 38 628 197 240 27 1021 280 77 207 702 194 33 494 75 1 72 274 140 79 200 845 38 528 1298 163 126 546 278 44 470 ...
result:
ok 2000 numbers
Subtask #2:
score: 22
Accepted
Dependency #1:
100%
Accepted
Test #5:
score: 22
Accepted
time: 113ms
memory: 8880kb
input:
8 300000 8 4 1 2 5 6 3 7 7 1 4 3 5 2 8 6 4 3 8 5 7 2 6 1 8 7 2 1 3 5 4 6 1 6 8 5 4 7 2 3 8 4 6 7 3 1 2 5 4 2 5 7 1 3 6 8 8 4 7 2 1 6 3 5 6 8 1 3 2 4 7 5 6 5 2 3 4 8 7 1 6 3 5 2 8 4 1 7 2 6 7 5 4 3 1 8 8 4 2 3 7 5 1 6 4 2 7 5 3 1 6 8 7 8 2 6 1 3 4 5 4 5 6 3 1 8 7 2 5 2 3 6 4 8 1 7 8 2 7 4 6 3 5 1 7 6...
output:
17022 43694 3691 4207 8987 1024 79547 3045 16830 7169 14418 14518 4895 51555 2871 14421 35694 856 807 58933 2373 4715 27147 10520 39295 26619 35845 23968 11140 5850 14445 4773 25178 2790 39377 7005 11113 34060 15968 1046 5305 2542 33276 22485 35186 7966 141907 4843 9905 2144 56198 7434 2000 36936 57...
result:
ok 300000 numbers
Test #6:
score: 0
Accepted
time: 109ms
memory: 9688kb
input:
8 300000 2 8 4 5 3 6 7 1 1 2 7 3 4 5 6 8 8 3 2 1 4 6 7 5 7 5 6 4 3 1 8 2 6 5 3 8 2 7 1 4 6 5 4 8 2 7 3 1 2 8 1 7 3 4 5 6 8 4 2 6 5 3 1 7 5 8 2 7 6 4 3 1 5 4 2 1 3 8 7 6 4 8 7 6 1 5 3 2 6 3 5 1 7 4 8 2 2 1 8 4 5 7 3 6 2 5 6 4 8 3 7 1 3 2 7 6 8 5 1 4 7 1 4 6 5 3 2 8 5 1 8 3 7 6 4 2 4 2 5 8 3 6 7 1 3 6...
output:
8490 192201 16512 1393 4879 1329 28477 4462 820 52267 913 17038 58898 12796 13187 19357 9330 13816 59641 4775 678 26768 99689 132385 22471 21878 715 20436 22107 1428 42282 138566 55387 119221 8597 1377 10083 47173 21039 245 26681 14808 9637 96932 27191 176024 14966 29734 138989 36952 17080 4429 6655...
result:
ok 300000 numbers
Test #7:
score: 0
Accepted
time: 108ms
memory: 9056kb
input:
8 300000 1 3 5 8 2 6 4 7 8 5 4 2 1 7 6 3 4 7 6 2 5 1 8 3 2 6 3 1 4 8 7 5 2 3 5 8 6 4 7 1 3 2 1 4 6 5 8 7 2 6 8 7 4 1 5 3 8 5 4 1 2 3 7 6 5 8 6 4 3 1 2 7 7 6 2 3 8 4 1 5 7 1 3 2 5 8 6 4 7 2 1 5 6 8 4 3 2 4 5 6 8 7 3 1 2 8 6 1 7 3 4 5 3 1 6 5 4 7 8 2 2 8 7 4 6 5 1 3 2 4 7 1 3 5 8 6 2 6 7 1 5 4 8 3 6 4...
output:
109610 3630 11021 84852 17152 169142 5885 7322 2122 4377 34617 14828 8843 14977 53878 2111 103839 31526 839 6430 123786 2354 14479 796 8901 6611 2196 1666 8586 27799 18167 7466 3400 109958 19367 33765 105415 161262 855 4370 7200 58816 7368 2135 71398 3718 94515 1770 17233 2966 73906 14825 7959 22106...
result:
ok 300000 numbers
Test #8:
score: 0
Accepted
time: 110ms
memory: 9544kb
input:
8 300000 5 2 7 1 6 8 3 4 2 5 1 6 8 7 3 4 2 3 5 1 8 6 7 4 5 6 4 1 2 3 7 8 1 7 5 4 3 2 8 6 1 4 3 7 5 8 2 6 3 4 1 7 5 2 8 6 2 1 8 3 5 6 4 7 2 4 1 5 3 6 8 7 8 7 1 2 6 3 5 4 2 7 3 4 6 8 1 5 6 2 3 7 1 4 8 5 5 8 2 3 7 6 1 4 4 6 1 7 2 5 3 8 4 7 2 5 6 8 1 3 6 2 3 4 5 8 1 7 7 5 1 3 2 6 8 4 8 4 3 1 5 2 7 6 2 1...
output:
28962 43580 74650 32444 56375 86881 94357 87813 183529 2085 25836 41812 5402 56726 10099 28589 20456 11506 130090 13239 15185 29208 60951 15002 357 10533 16014 3933 40802 21585 13795 22384 820 108123 25752 2093 9056 12805 6467 15914 8653 43542 6910 3209 2103 47948 80638 30148 5631 21606 26259 9996 4...
result:
ok 300000 numbers
Subtask #3:
score: 19
Accepted
Dependency #1:
100%
Accepted
Test #9:
score: 19
Accepted
time: 326ms
memory: 20792kb
input:
9 2000 7 1 3 2 9 6 4 8 5 5 3 1 7 9 8 4 2 6 5 3 6 8 9 4 1 7 2 5 2 4 3 7 6 1 8 9 3 8 7 1 5 4 6 9 2 4 3 7 2 5 9 6 8 1 4 1 9 5 6 7 2 3 8 6 4 9 5 7 1 8 3 2 3 6 7 2 9 4 8 1 5 1 4 9 5 2 6 8 7 3 9 7 1 4 2 6 3 8 5 3 9 7 5 4 6 8 1 2 9 6 4 7 2 8 3 1 5 1 8 9 2 3 7 4 5 6 4 5 6 8 3 7 9 2 1 7 1 9 3 6 2 4 8 5 9 4 7...
output:
258 134 30 405 83 84 176 13 84 188 34 12 7 100 12 117 5 86 51 2 572 87 15 118 500 104 152 27 37 397 49 1 42 12 3 645 54 7 6 6 3 6 478 267 231 243 246 17 2 178 91 304 77 69 25 19 35 413 52 71 163 1166 1141 8 616 206 46 21 536 18 59 37 270 1024 624 84 9 83 146 147 60 10 471 15 408 132 157 382 18 131 9...
result:
ok 2000 numbers
Test #10:
score: 0
Accepted
time: 322ms
memory: 19780kb
input:
9 2000 8 9 1 2 5 6 4 7 3 6 7 2 4 5 8 1 3 9 7 4 8 6 3 1 2 9 5 8 5 6 4 1 9 3 2 7 6 3 1 2 8 7 4 5 9 8 7 3 2 9 1 6 5 4 3 1 4 8 2 5 9 6 7 1 3 5 2 9 6 4 7 8 4 3 2 9 6 1 7 5 8 9 7 2 3 6 1 5 4 8 4 8 3 9 7 2 5 1 6 9 6 3 7 1 4 2 5 8 1 9 7 8 2 6 4 3 5 2 3 7 8 5 6 1 4 9 1 5 9 4 3 2 8 7 6 1 5 7 9 2 8 3 4 6 6 5 7...
output:
22 96 36 22 523 18 799 1013 302 28 16 30 14 290 293 194 107 74 69 601 18 5 3 82 6 366 2 59 51 91 26 172 2 21 22 217 310 2 160 29 14 160 16 380 52 14 38 89 454 2 24 27 129 2 143 747 30 46 219 33 244 2 86 150 12 65 207 692 36 160 41 27 359 37 239 141 42 10 4 9 95 2 219 2 20 103 399 292 21 55 11 24 691...
result:
ok 2000 numbers
Subtask #4:
score: 49
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #11:
score: 49
Accepted
time: 699ms
memory: 21472kb
input:
9 300000 8 4 2 3 6 1 7 5 9 1 3 2 5 9 8 7 6 4 4 8 9 7 3 5 2 6 1 9 8 2 4 5 7 6 3 1 5 7 4 6 1 3 2 8 9 4 3 8 9 2 1 7 5 6 4 9 3 5 8 6 1 2 7 4 1 8 5 6 9 2 3 7 4 9 6 7 5 3 1 8 2 3 2 8 4 5 6 1 9 7 2 7 5 6 8 1 9 3 4 9 5 1 8 6 2 3 7 4 3 8 7 9 4 6 5 2 1 5 3 1 2 6 9 7 4 8 2 8 5 6 4 7 3 9 1 5 4 9 3 6 1 7 2 8 4 7...
output:
22113 49143 356 158 19253 13512 4006 32265 1124 51212 16000 2878 276 76350 6185 10243 30447 1510 4915 60022 2013 2336 99140 313 29636 10682 7436 3342 67965 26856 5492 10613 98537 12985 460 276 11075 24667 6817 93049 21294 13001 6171 21088 15897 18498 1179 2800 1090 79446 2933 984 30467 1194 6552 900...
result:
ok 300000 numbers
Test #12:
score: 0
Accepted
time: 689ms
memory: 21760kb
input:
9 300000 3 4 8 2 7 6 9 1 5 9 3 7 5 6 4 8 2 1 7 4 6 9 1 2 3 5 8 9 7 4 2 6 1 8 5 3 9 7 2 5 6 3 8 1 4 9 6 8 4 3 7 5 1 2 4 8 5 2 9 7 6 1 3 8 5 4 6 7 9 2 1 3 8 6 7 1 5 9 3 4 2 2 6 3 9 5 8 1 4 7 8 5 4 7 9 6 2 1 3 7 2 1 3 4 9 8 6 5 6 2 9 5 3 7 4 8 1 6 5 1 7 4 3 2 8 9 6 8 4 7 2 9 1 5 3 5 6 9 3 2 4 7 8 1 7 5...
output:
16152 252 10063 1177 850 98 3147 620 724 24990 407 35402 4468 31152 2628 2893 8582 2416 575 23079 945 5739 2888 42797 3288 4627 2300 423 64716 163328 2052 2781 38635 166045 10210 34963 3904 8749 6087 5464 6402 4309 32823 84734 10128 4311 43708 15334 20657 4495 1432 21912 7222 1828 72521 12492 9582 1...
result:
ok 300000 numbers
Test #13:
score: 0
Accepted
time: 683ms
memory: 21768kb
input:
9 300000 9 3 5 7 6 8 2 4 1 4 9 3 7 1 2 5 8 6 2 6 4 1 8 3 7 9 5 6 5 1 8 4 2 9 7 3 8 6 9 1 7 5 4 3 2 2 1 7 8 9 5 4 6 3 3 9 5 2 7 6 1 8 4 6 4 5 8 1 2 9 7 3 3 1 6 5 4 8 2 7 9 2 5 8 6 4 3 7 1 9 7 4 5 3 9 6 1 8 2 9 3 2 8 5 1 4 7 6 3 7 9 1 2 6 5 4 8 6 2 1 5 8 3 4 7 9 5 7 1 8 6 4 3 2 9 1 8 9 7 6 3 4 2 5 8 2...
output:
390 13947 83908 16341 237 15397 9061 11717 128912 22154 3752 5474 25705 85381 12716 1700 11769 7004 8909 12585 714 993 3109 4660 368 108330 302 89561 2377 50039 3262 883 8107 6637 1496 17569 11120 15409 5314 4424 7546 11893 323 1419 745 7525 46888 3086 126013 100764 5738 3844 39498 110322 901 1235 2...
result:
ok 300000 numbers
Test #14:
score: 0
Accepted
time: 686ms
memory: 21792kb
input:
9 300000 9 5 6 4 1 2 3 8 7 8 7 9 1 5 6 3 4 2 2 6 1 5 3 9 7 8 4 4 9 2 6 3 7 5 8 1 7 4 1 9 8 5 3 6 2 1 8 9 7 6 3 5 4 2 6 7 5 8 4 2 3 1 9 7 4 1 8 2 9 6 3 5 8 3 1 9 6 2 4 7 5 4 1 8 5 7 3 6 9 2 8 5 3 6 4 2 7 9 1 1 4 6 3 8 2 9 5 7 9 8 1 6 5 7 2 3 4 5 2 1 4 8 9 6 3 7 9 6 3 2 5 1 4 7 8 8 7 9 1 2 4 3 6 5 6 9...
output:
3358 233 68454 4890 3620 745 1409 14294 11557 23218 2109 108853 401 53125 5785 1915 3380 119313 11214 9304 50342 6110 2582 6063 356 4519 34113 2767 16443 13497 20335 9639 4990 3025 16002 23830 6760 1210 44149 687 23348 1451 13989 17647 9358 13147 91963 3203 722 9032 15402 51766 5427 413 42285 3435 1...
result:
ok 300000 numbers
Test #15:
score: 0
Accepted
time: 692ms
memory: 21568kb
input:
9 300000 4 8 3 6 1 2 9 5 7 1 8 2 6 7 3 9 4 5 5 1 8 7 2 3 9 4 6 9 7 6 3 8 5 2 4 1 7 1 3 8 9 4 5 2 6 4 8 6 3 2 1 9 7 5 8 9 1 5 3 7 6 2 4 2 8 4 6 5 9 7 1 3 8 3 1 6 2 5 7 9 4 1 5 4 3 2 9 7 6 8 1 7 4 5 9 8 2 6 3 1 4 9 5 6 2 3 8 7 1 5 7 4 6 2 3 8 9 5 1 6 7 4 3 8 9 2 8 2 1 3 7 5 6 4 9 4 7 9 6 8 3 1 2 5 9 2...
output:
26652 34360 36692 71 12972 13862 1487 6870 23448 136840 17171 45123 92721 22867 39238 1181 14416 4616 2874 54 38086 52521 37917 6040 3875 20108 5192 1086 15214 24308 2063 9752 51408 24899 194697 3933 2391 28163 54957 2048 3812 2059 14053 167899 535 1213 600 4556 78700 37079 42159 2150 55650 14202 34...
result:
ok 300000 numbers
Test #16:
score: 0
Accepted
time: 685ms
memory: 21512kb
input:
9 300000 3 4 6 9 7 2 5 1 8 7 4 8 9 5 2 3 1 6 4 1 3 2 8 5 7 9 6 9 4 5 7 3 1 6 2 8 3 7 4 8 1 5 9 6 2 7 8 9 4 5 2 6 3 1 3 5 2 7 9 8 1 6 4 4 2 5 6 7 9 1 8 3 8 9 6 3 1 7 5 2 4 8 9 1 6 3 2 7 4 5 6 9 1 7 2 3 4 5 8 2 1 8 6 5 7 3 9 4 5 4 3 2 8 6 7 9 1 8 9 3 6 5 2 1 7 4 1 2 3 7 4 9 5 8 6 6 8 9 4 3 1 2 5 7 5 2...
output:
11218 1010 121679 2635 14491 115 17023 23446 485 2585 13143 52124 11557 823 138246 2090 40056 4101 23613 4670 1399 23496 20746 12318 9823 56165 4501 299 116528 4809 247 2590 12356 1402 12110 7898 1871 38046 56460 4100 16000 76776 2866 1244 6392 46095 4884 3362 1943 2605 24066 9992 11082 21555 65842 ...
result:
ok 300000 numbers
Test #17:
score: 0
Accepted
time: 685ms
memory: 21568kb
input:
9 300000 1 9 4 6 3 5 8 2 7 3 2 8 7 6 5 1 4 9 6 5 7 3 4 2 8 1 9 4 9 6 2 7 8 5 3 1 4 7 8 2 6 1 5 3 9 8 2 4 5 6 1 7 3 9 6 7 8 3 1 4 9 2 5 6 4 7 1 9 3 2 5 8 8 4 2 3 7 9 5 1 6 3 5 4 8 6 2 7 9 1 4 2 1 5 6 8 3 9 7 3 6 7 2 9 8 5 1 4 3 5 8 7 6 2 9 1 4 5 6 8 2 9 7 1 4 3 7 1 5 9 4 2 3 8 6 3 9 2 4 7 8 6 1 5 2 1...
output:
20937 25684 5692 840 16577 20509 5257 20436 6068 10315 118032 6099 6350 2960 21551 5451 36548 5257 8090 25704 4441 2592 22423 19964 45126 20769 84012 7290 15559 1491 3023 2590 7159 4105 39329 147816 38500 3962 2440 39402 83955 28060 19371 26479 3284 12463 2436 82911 52342 13685 1850 14271 10361 910 ...
result:
ok 300000 numbers
Test #18:
score: 0
Accepted
time: 676ms
memory: 21520kb
input:
9 300000 8 3 6 5 4 2 1 9 7 5 2 6 8 9 4 7 1 3 9 1 2 6 3 4 7 5 8 1 9 8 6 5 4 7 2 3 3 9 1 4 5 6 2 7 8 8 5 6 3 9 2 4 1 7 6 1 5 4 2 3 7 8 9 6 7 8 4 9 2 5 1 3 9 4 1 5 7 2 6 3 8 7 5 3 2 1 9 8 6 4 7 5 8 2 4 9 6 3 1 9 1 2 6 3 4 7 5 8 7 5 2 1 4 9 6 8 3 3 2 7 5 4 8 6 9 1 6 9 4 1 3 2 7 8 5 2 6 9 4 7 5 3 1 8 7 9...
output:
7056 4570 25506 1377 35578 1908 85431 660 10360 13141 941 25506 15934 22509 10199 9094 97 2063 7768 12673 5413 29818 4478 3633 16703 1285 183 12756 15824 371 3566 90221 2249 824 967 778 5580 65928 14502 705 7103 2614 1879 95 52691 34616 28499 88129 17597 6504 13921 11432 12037 1696 68681 4961 3688 1...
result:
ok 300000 numbers
Test #19:
score: 0
Accepted
time: 688ms
memory: 22016kb
input:
9 300000 5 2 8 6 9 7 4 3 1 9 2 7 4 8 3 6 1 5 2 9 8 1 4 6 3 7 5 9 5 7 1 4 2 6 8 3 8 7 9 6 3 1 4 2 5 8 9 1 2 7 6 4 5 3 5 6 9 7 8 1 2 3 4 8 2 3 6 9 5 7 4 1 3 8 7 9 2 5 1 4 6 1 8 9 2 3 5 6 7 4 2 3 9 5 4 1 8 6 7 2 6 7 8 9 3 5 4 1 4 6 5 7 9 8 2 3 1 4 9 3 2 6 5 7 8 1 5 4 3 6 7 2 1 9 8 5 9 6 1 3 7 8 4 2 9 1...
output:
1226 1461 9258 2697 189 1127 1451 2181 4303 14220 38667 1862 892 4978 21163 2815 11173 113 15558 52465 90142 65045 8741 16913 5386 19605 49472 900 16873 24616 8928 27128 12480 8501 15349 10588 38189 24117 225 7641 9178 1071 2299 1486 19687 3270 10451 31167 97 20192 5590 79886 254289 2106 38175 250 1...
result:
ok 300000 numbers
Test #20:
score: 0
Accepted
time: 695ms
memory: 21512kb
input:
9 300000 4 6 3 9 8 2 5 7 1 9 5 1 4 6 8 3 2 7 2 5 7 4 3 8 1 9 6 4 1 8 5 9 6 2 3 7 6 2 5 9 8 1 4 7 3 3 6 1 4 7 2 9 5 8 9 2 1 4 3 5 6 7 8 8 6 9 7 5 3 2 4 1 3 5 4 1 8 6 2 7 9 7 9 6 5 2 1 3 4 8 8 1 5 4 2 9 3 7 6 3 9 1 8 5 7 2 6 4 9 5 4 2 8 3 1 6 7 7 5 6 2 1 3 4 9 8 6 9 7 8 2 3 1 5 4 4 9 2 7 6 8 3 1 5 2 4...
output:
3217 3966 46240 23989 7827 97159 28777 27 86100 1278 24635 6659 2891 16800 623 3015 40079 3987 9926 129471 8018 24476 32506 28259 10060 12335 8042 6357 8942 73619 44830 8145 75566 38641 53316 4162 1555 11818 26905 104575 488 2965 3227 70108 55798 4218 38774 4199 20582 2148 2827 48912 28609 50703 129...
result:
ok 300000 numbers