QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#764504 | #8324. 迷宫守卫 | yhddd | 100 ✓ | 42ms | 51400kb | C++20 | 3.6kb | 2024-11-20 09:30:28 | 2024-11-20 09:30:29 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=150010;
inline ll read(){
ll x=0,fl=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')fl=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch-'0');ch=getchar();}
return x*fl;
}
const ll inf=2e18;
int n,m;ll k;
ll a[maxn];int b[maxn];
vector<int> val[maxn];
int pre[maxn],suf[maxn];
ll dp[17][maxn];int to[17][maxn];
short flag[17][maxn];
void dfs(int u){
if(u>=m)return ;
vector<int>().swap(val[u]);
int ls=u<<1,rs=u<<1|1,dep=31^__builtin_clz(u);
dfs(ls),dfs(rs);
int hl=0,hr=0;
while(hl<val[ls].size()&&hr<val[rs].size()){
if(val[ls][hl]>val[rs][hr])val[u].push_back(val[ls][hl]),hl++;
else val[u].push_back(val[rs][hr]),hr++;
}
while(hl<val[ls].size())val[u].push_back(val[ls][hl]),hl++;
while(hr<val[rs].size())val[u].push_back(val[rs][hr]),hr++;
pre[0]=val[rs][0];
for(int i=1;i<val[rs].size();i++){
if(dp[dep+1][val[rs][i]]<dp[dep+1][pre[i-1]])pre[i]=val[rs][i];
else pre[i]=pre[i-1];
}
suf[val[rs].size()-1]=val[rs].back();
for(int i=val[rs].size()-2;~i;i--){
if(dp[dep+1][val[rs][i]]<dp[dep+1][suf[i+1]])suf[i]=val[rs][i];
else suf[i]=suf[i+1];
}
for(int i=0,j=-1;i<val[ls].size();i++)if(dp[dep+1][val[ls][i]]<=k){
while(j+1<val[rs].size()&&val[rs][j+1]>val[ls][i])j++;
if(~j){
ll v=dp[dep+1][val[ls][i]]+dp[dep+1][pre[j]];
if(dp[dep][val[ls][i]]>v){
dp[dep][val[ls][i]]=v;
to[dep][val[ls][i]]=pre[j];
}
}
if(j!=val[rs].size()-1){
ll v=dp[dep+1][val[ls][i]]+a[u];
if(dp[dep][val[ls][i]]>v){
dp[dep][val[ls][i]]=v;
to[dep][val[ls][i]]=suf[j+1];
flag[dep][val[ls][i]]=2;
}
}
}
pre[0]=val[ls][0];
for(int i=1;i<val[ls].size();i++){
if(dp[dep+1][val[ls][i]]<dp[dep+1][pre[i-1]])pre[i]=val[ls][i];
else pre[i]=pre[i-1];
}
for(int i=0,j=-1;i<val[rs].size();i++)if(dp[dep+1][val[rs][i]]<=k){
while(j+1<val[ls].size()&&val[ls][j+1]>val[rs][i])j++;
if(~j){
ll v=dp[dep+1][pre[j]]+dp[dep+1][val[rs][i]];
if(dp[dep][val[rs][i]]>v){
dp[dep][val[rs][i]]=v;
to[dep][val[rs][i]]=pre[j];
flag[dep][val[rs][i]]=1;
}
}
}
}
ll res;
int ans[maxn],tp;
void dfs1(int u,int num){
if(u>=m){ans[++tp]=b[u];return ;}
int ls=u<<1,rs=u<<1|1,dep=31^__builtin_clz(u);
if(flag[dep][num]==1){
dfs1(rs,num);
for(int i:val[ls])if(to[dep][num]<=i){
if(dp[dep+1][i]-dp[dep+1][to[dep][num]]<=res){
res-=(dp[dep+1][i]-dp[dep+1][to[dep][num]]);
dfs1(ls,i);
break;
}
}
}
else if(!flag[dep][num]){
dfs1(ls,num);
for(int i:val[rs])if(to[dep][num]<=i){
if(dp[dep+1][i]-dp[dep+1][to[dep][num]]<=res){
res-=(dp[dep+1][i]-dp[dep+1][to[dep][num]]);
dfs1(rs,i);
break;
}
}
}
else{
dfs1(ls,num);
for(int i:val[rs])if(num<i){
if(dp[dep+1][i]-a[u]<=res){
res-=(dp[dep+1][i]-a[u]);
dfs1(rs,i);
return ;
}
}
for(int i:val[rs])if(to[dep][num]<=i){
if(dp[dep+1][i]<=res){
res-=(dp[dep+1][i]);
dfs1(rs,i);
break;
}
}
}
}
void sovle(){
n=read(),m=1<<n,k=read();
for(int i=1;i<m;i++)a[i]=read();
for(int i=m;i<=m*2-1;i++)b[i]=read();
for(int i=0;i<=n;i++)for(int j=1;j<=m;j++)dp[i][j]=inf,flag[i][j]=0;
for(int i=m;i<m*2;i++){
dp[n][b[i]]=0;
vector<int>().swap(val[i]);
val[i].push_back(b[i]);
}
dfs(1);
for(int i=m;i;i--)if(dp[0][i]<=k){
res=k-dp[0][i];
dfs1(1,i);
printf("%lld",ans[1]);
for(int j=2;j<=tp;j++)printf(" %lld",ans[j]);
printf("\n");tp=0;
return ;
}
}
int T;
signed main(){
// freopen("maze.in","r",stdin);
// freopen("maze.out","w",stdout);
T=read();
while(T--)sovle();
}
详细
Pretests
Final Tests
Test #1:
score: 5
Accepted
time: 0ms
memory: 18136kb
input:
5 4 41704513771 63172871346 30595220734 16095671102 3822055819 13738718698 5991071599 14075850903 6874431191 1954448141 4475339255 4509212246 3504301339 4327559573 3485545593 2074035498 7 9 5 16 3 4 1 11 14 12 2 8 15 6 13 10 4 63715445249 61413836337 11125139971 8494516376 13086757419 19161322522 93...
output:
6 15 10 13 12 14 2 8 7 9 5 16 1 11 3 4 3 6 1 15 8 5 12 10 7 4 9 13 11 16 2 14 1 16 7 4 15 9 3 13 2 12 6 14 5 11 8 10 11 16 1 2 5 12 6 9 14 8 10 13 3 7 4 15 2 6 10 5 13 12 7 3 14 8 16 11 15 4 1 9
result:
ok 5 lines
Test #2:
score: 5
Accepted
time: 3ms
memory: 20364kb
input:
5 4 77339380239 81895899866 48344406140 3046718575 7110699715 3972565764 7732374665 6292498163 12486498794 3363604 9980601599 6263469257 3057425890 2429533238 4572510501 2187576167 15 2 5 7 1 13 14 10 3 4 16 8 9 11 6 12 4 37630135888 44732450063 40210162157 6384089682 4618779030 8328589818 147568590...
output:
3 4 16 8 9 11 6 12 15 2 5 7 1 13 10 14 10 8 5 2 14 3 1 4 11 12 13 16 6 15 7 9 1 15 16 2 13 3 4 14 5 11 8 6 7 9 12 10 4 12 11 1 3 10 8 9 5 14 15 2 7 6 13 16 8 10 2 14 11 12 15 3 1 16 4 9 5 7 6 13
result:
ok 5 lines
Test #3:
score: 5
Accepted
time: 0ms
memory: 18116kb
input:
5 4 34893391512 26053943776 45137145772 9525790347 6244540920 15146115409 8558045030 2197707629 2912706108 8598620741 9616527941 5107315902 7164914802 3758081752 1728413392 3704449708 1 5 3 2 16 15 11 9 7 10 12 13 6 14 8 4 4 31567183393 10985614313 25547317620 20499357354 3806371768 864415909 420391...
output:
1 5 3 2 16 15 9 11 4 8 6 14 7 10 12 13 5 3 14 8 15 1 11 7 4 10 6 12 9 13 2 16 8 5 16 14 15 1 2 11 12 4 9 10 3 7 6 13 3 1 4 12 7 15 8 14 6 9 2 5 10 11 13 16 16 7 5 2 8 13 10 15 9 6 3 11 1 12 4 14
result:
ok 5 lines
Test #4:
score: 5
Accepted
time: 0ms
memory: 20252kb
input:
5 4 64526803118 81700304744 29570105266 13540707295 5272323562 7638728067 8087907239 2844705697 12147211174 5137101764 358865602 4913699397 2913573812 3870170710 2834045717 2569759294 3 6 4 13 1 8 11 12 9 16 2 5 7 14 15 10 4 48301519274 22007257328 28325952217 10828692751 6900017612 3320794226 42011...
output:
3 6 4 13 1 8 11 12 9 16 2 5 7 14 15 10 7 9 14 5 2 8 3 1 10 13 12 15 4 11 6 16 6 10 8 9 15 7 4 5 12 2 1 16 14 11 3 13 10 6 15 12 8 1 11 4 14 16 7 9 5 3 13 2 9 8 7 16 12 14 4 10 15 2 11 5 6 3 1 13
result:
ok 5 lines
Test #5:
score: 5
Accepted
time: 0ms
memory: 18188kb
input:
5 4 4863158478 40607600527 2421619125 32450416748 10777143852 5594001099 11510465755 2056752878 7334350461 5373375310 7205056137 494938545 3987861103 3739397274 7072693146 4300805097 8 12 14 9 1 11 7 2 13 5 15 10 6 16 3 4 4 50212387584 1103380725 64230244 17714471343 22345342654 11697933803 95423187...
output:
5 13 10 15 6 16 3 4 8 12 9 14 1 11 2 7 4 15 6 2 9 11 3 14 8 12 1 5 7 10 13 16 7 3 13 9 1 15 2 14 10 16 6 8 11 5 12 4 2 8 12 5 16 7 1 15 10 14 4 6 11 9 3 13 1 16 6 10 7 15 13 14 11 2 12 3 4 8 9 5
result:
ok 5 lines
Test #6:
score: 5
Accepted
time: 3ms
memory: 22288kb
input:
5 6 54745168585 23433156564 23536806253 15372713850 18216219454 8589226497 10865021681 2253546280 907002273 5317503603 475806625 82106518 690500370 6959464451 6238313289 2696179814 2324765017 2290127697 3363593390 342590783 121348581 771888970 4362965169 3207675963 2439991837 587957532 1343945881 18...
output:
53 54 56 55 51 52 49 50 58 57 59 60 61 62 63 64 37 38 39 40 34 33 36 35 41 42 43 44 47 48 45 46 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 17 19 20 21 22 23 24 25 26 27 28 29 30 31 32 12 11 10 9 13 14 15 16 1 2 4 3 5 6 7 8 17 18 19 20 22 21 23 24 25 26 27 28 30 29 31 32 16 15 14 13 12 11 10 9 8 7 6 5...
result:
ok 5 lines
Test #7:
score: 5
Accepted
time: 0ms
memory: 24288kb
input:
5 6 12 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 26 38 60 53 48 54 5 32 19 27 20 7 4 61 44 30 62 63 37 43 9 58 33 13 24 18 50 6 34 3 2 57 41 29 28 55 52 17 8 1 22 10 46 40 16 36 15 21 23 45 49 64 42 35 39 11 47 31 12...
output:
26 38 60 53 48 54 5 32 19 27 20 7 4 61 44 30 62 63 37 43 9 58 33 13 6 50 18 24 2 57 3 34 1 8 17 52 28 55 29 41 10 22 40 46 15 21 16 36 11 39 35 42 23 45 49 64 12 14 31 47 25 56 51 59 1 31 7 14 2 3 5 8 6 24 20 23 9 28 13 27 4 25 10 15 12 30 19 29 11 16 18 26 17 32 21 22 2 32 12 17 7 14 11 31 3 19 15 ...
result:
ok 5 lines
Test #8:
score: 5
Accepted
time: 0ms
memory: 26456kb
input:
5 6 15 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 35 4 24 16 55 20 49 5 17 32 25 14 23 19 57 18 31 1 45 8 3 58 2 59 60 51 40 13 9 21 61 29 46 41 30 44 42 56 48 7 27 28 22 54 52 34 47 26 43 10 33 11 63 62 37 50 38 39 6...
output:
35 4 24 16 55 20 49 5 17 32 25 14 23 19 57 18 9 21 29 61 13 40 51 60 31 1 45 8 2 59 3 58 6 53 38 39 12 64 15 36 10 43 11 33 37 50 62 63 7 48 42 56 30 44 41 46 22 54 27 28 26 47 34 52 5 17 28 31 9 16 13 24 1 18 8 20 11 25 26 32 2 22 3 12 6 23 7 19 4 27 15 30 10 14 21 29 28 18 25 30 26 32 20 17 1 27 1...
result:
ok 5 lines
Test #9:
score: 5
Accepted
time: 0ms
memory: 24372kb
input:
5 6 41682514268 65512460533 23389539380 17127541806 13879623608 18454598020 11859665553 4427727406 9224733854 10393341296 8919804232 8517294999 7182700425 6740147596 4027193471 2058512521 792633359 4533477482 980684284 2664612081 4521381730 2856886140 1715375705 1335499956 1378534167 1242250449 3240...
output:
15 48 14 26 33 17 37 51 21 38 5 52 34 30 41 18 32 45 2 36 46 57 1 20 40 49 13 54 53 3 7 23 16 29 35 63 19 28 31 59 22 24 27 43 6 9 47 64 39 56 8 50 10 12 44 61 42 11 58 60 4 62 25 55 10 24 30 6 23 4 1 9 13 25 14 27 31 26 8 18 11 12 16 7 5 15 21 29 2 22 17 19 3 20 28 32 2 27 22 24 9 13 31 17 26 19 12...
result:
ok 5 lines
Test #10:
score: 5
Accepted
time: 2ms
memory: 22228kb
input:
5 6 24811678845 59366612184 49154633743 6012028601 18488464455 3698079115 15237755546 9897513757 11297313825 1235390268 9537679832 6527345169 6788541803 6092835632 3757166512 2775821228 5038810767 5132680421 224613865 3922090240 3516928234 4550183827 807384027 3474382046 2163118984 1933277169 237629...
output:
3 22 7 52 9 49 2 57 16 26 29 24 58 6 40 25 5 17 23 56 53 27 50 43 10 45 1 59 34 13 36 54 4 47 46 8 48 14 61 64 18 31 51 55 60 39 44 12 21 62 35 63 28 15 37 33 32 42 41 19 38 30 20 11 1 28 5 7 19 24 18 26 4 17 13 31 12 14 3 2 27 25 11 15 8 30 6 10 29 32 16 21 9 22 20 23 5 12 25 9 24 21 32 31 8 4 30 1...
result:
ok 5 lines
Test #11:
score: 5
Accepted
time: 0ms
memory: 32828kb
input:
8 11 8529168063 96069180507 14546522039 16201831539 11081688135 14127492888 5483527826 5423117536 5383419437 4400835611 4101982754 1519595961 5245792592 361617983 2749618781 1961362420 6071049745 3218074367 883237862 766782110 1284574799 1163029746 1829051469 1302409327 2105572087 1587995436 2901202...
output:
394 393 396 395 397 398 400 399 385 386 387 388 389 390 391 392 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 ...
result:
ok 8 lines
Test #12:
score: 5
Accepted
time: 0ms
memory: 30948kb
input:
8 11 571 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:
1960 1995 2047 1968 1956 2044 2000 2004 2041 1942 1955 2028 2037 2036 1964 1938 1952 2032 1941 1971 1957 2006 1932 1989 1928 1950 2023 1922 2021 1978 1992 1976 2017 2043 1916 1965 1972 1929 1940 1974 1951 1930 1949 1982 1977 1914 1953 1917 1966 1937 1935 1963 1999 1939 1967 1925 2002 1993 1909 1934 ...
result:
ok 8 lines
Test #13:
score: 5
Accepted
time: 3ms
memory: 32808kb
input:
8 11 252 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:
1961 1998 2002 1969 2013 2044 1967 2025 1947 1975 2039 1942 2043 2027 2035 2034 1986 2006 2008 1982 2030 1988 2028 1956 1940 1957 2023 1925 1944 1930 1973 1934 2031 1919 1945 1958 2014 2012 1922 1932 2016 1935 1911 1909 2001 1948 1920 2005 2033 2003 1900 1928 1913 1929 2017 1943 1921 2048 1978 1990 ...
result:
ok 8 lines
Test #14:
score: 5
Accepted
time: 0ms
memory: 34892kb
input:
8 11 170392530264 74651887849 17611792511 11288590546 6568520318 11787580396 1038293275 8132485406 811722341 6463339368 5578666288 6988124667 5250658163 7545924747 436981583 4449296950 4837617209 5423956155 3263388134 1290388306 4273188134 2502801698 455787408 2184397509 900391791 934924549 11250348...
output:
1963 2048 2036 2029 2006 2044 2043 1987 1977 2004 1954 2034 1938 2037 1973 2035 1995 2032 1955 1937 2030 2028 1975 1957 1928 1940 2023 1923 1951 1947 1981 1941 1992 1965 2007 2002 2013 2012 1934 2009 1909 1916 2045 2011 2040 2041 1922 1921 1927 2000 1924 1968 1997 2033 1996 1994 1964 1943 2019 1901 ...
result:
ok 8 lines
Test #15:
score: 5
Accepted
time: 0ms
memory: 34916kb
input:
8 11 10817060597 85858621967 47769507919 2550569053 4936407038 4200947363 15181090532 2195335264 1279109336 9430376850 3667617132 2581310809 1530224542 7058648206 133323350 150591857 3490174463 5246064700 5403826000 616788461 4805350827 2971535312 1549457606 1430948590 1859856676 2761221467 10782807...
output:
679 772 801 723 707 751 891 945 745 807 775 795 726 746 815 1083 694 846 739 1287 702 763 714 842 699 767 879 715 716 861 769 857 709 802 719 720 721 734 864 877 727 809 733 898 732 762 752 782 737 824 738 788 766 935 773 774 753 840 760 832 768 808 811 957 743 1062 917 1023 765 771 781 862 744 889 ...
result:
ok 8 lines
Test #16:
score: 5
Accepted
time: 29ms
memory: 51400kb
input:
17 16 185467288814 92060578373 47290795643 9286036925 9228394756 4811881952 8646592030 8944909812 2841304722 6070010500 6008789791 6082937518 4490550145 5615562853 6824949729 4377456320 5710382139 2189154879 2907374836 4635243843 815487121 3594634884 1123206624 3451101389 1464409182 3816376047 99149...
output:
65536 65535 65534 65533 65532 65531 65530 65529 65528 65527 65526 65525 65524 65523 65522 65521 65520 65519 65518 65517 65516 65515 65514 65513 65512 65511 65510 65509 65508 65507 65506 65505 65504 65503 65502 65501 65500 65499 65498 65497 65496 65495 65494 65493 65492 65491 65490 65489 65488 65487 ...
result:
ok 17 lines
Test #17:
score: 5
Accepted
time: 42ms
memory: 50740kb
input:
17 16 8329 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:
65444 65489 65480 65475 65464 65476 65518 65487 65529 65528 65527 65478 65453 65486 65446 65522 65470 65434 65429 65501 65517 65516 65471 65431 65433 65436 65443 65472 65425 65424 65507 65417 65505 65504 65428 65460 65449 65488 65437 65432 65500 65404 65495 65503 65494 65492 65491 65391 65438 65511 ...
result:
ok 17 lines
Test #18:
score: 5
Accepted
time: 34ms
memory: 51252kb
input:
17 16 15956 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:
65448 65536 65535 65467 65533 65532 65443 65530 65529 65468 65527 65433 65525 65524 65474 65519 65494 65460 65430 65459 65482 65523 65516 65514 65445 65512 65500 65455 65431 65444 65507 65407 65526 65463 65462 65502 65511 65501 65499 65515 65498 65520 65521 65395 65510 65496 65488 65428 65465 65425 ...
result:
ok 17 lines
Test #19:
score: 5
Accepted
time: 39ms
memory: 50328kb
input:
17 16 123563911790 35459655441 43632569067 27856417624 17183249762 11408415432 6410374431 4355108219 10839722895 1557427267 8039957610 3261023448 863292515 2321876702 4529787424 6094181663 5552293666 1229609052 3243632422 3258596121 2777539196 218149318 857735919 4190629450 13122153 235727176 405797...
output:
65449 65483 65462 65496 65533 65502 65471 65480 65434 65528 65459 65428 65525 65524 65519 65536 65470 65466 65430 65520 65461 65444 65515 65441 65477 65512 65494 65500 65509 65487 65499 65406 65475 65504 65532 65418 65510 65403 65468 65409 65443 65497 65511 65425 65522 65427 65421 65508 65495 65489 ...
result:
ok 17 lines
Test #20:
score: 5
Accepted
time: 39ms
memory: 51268kb
input:
17 16 2433509850 94402852594 4739314371 10807842811 23113510462 3844106361 15285318548 11429331314 4513086672 6976145076 7406862331 3902969782 4483098352 4142852842 6501115945 6642627273 3048275771 3986632722 890509821 3063792232 3653510136 2720826892 1129556719 655572505 3248045315 2596327240 19596...
output:
3163 3042 2994 3028 3056 3044 3005 2992 3115 2968 2986 3007 2972 3003 3152 2987 2957 3000 3060 3202 3081 3154 2977 3165 3055 2999 3069 3225 3144 2975 2988 3140 3223 2959 2966 3038 2971 2985 2945 2998 3021 2942 2939 2936 2965 3067 3173 3017 2933 3012 2956 3118 2960 2961 2962 3082 3142 3016 2967 2950 ...
result:
ok 17 lines