QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#771200 | #9135. Teleports | guanzy | AC ✓ | 98ms | 5832kb | C++14 | 765b | 2024-11-22 10:46:41 | 2024-11-22 10:46:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const long long inf=1e16;
int n,a[510],vis[510];
long long f[510][510],g[510];
int main(){
cin>>n;
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
for(int t=1;t<n;t++){
for(int l=1,r=l+t;r<=n;l++,r++){
g[l]=inf;vis[l]=0;
for(int i=l/2+1;i<=r/2;i++) g[l]=min(g[l],max(f[1][2*i-l],f[i*2][r])+a[i]);
for(int i=(n+l)/2+1;i<=(n+r)/2;i++) g[l]=min(g[l],max(f[l][2*i-n-1],f[2*i-r][n])+a[i]);
}
for(int i=1;i+t<=n;i++){
int k=0,r;
for(int l=1;l+t<=n;l++){
if((k==0||g[l]<g[k])&&!vis[l]) k=l;
}
vis[k]=1;r=k+t;//cout<<k<<endl;
for(int j=r/2+1;j<=(n+k)/2;j++) g[j*2-r]=min(g[j*2-r],g[k]+a[j]);
}
for(int i=1;i+t<=n;i++) f[i][i+t]=g[i];
}
cout<<f[1][n];
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3732kb
input:
3 5 2 1
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
12 18 19 11 2 20 15 18 1 14 1 1 1
output:
6
result:
ok 1 number(s): "6"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
1 394579745
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
10 442563005 781853815 340856122 393563789 976401485 97046388 384819624 528914768 276461577 716668497
output:
1472691676
result:
ok 1 number(s): "1472691676"
Test #5:
score: 0
Accepted
time: 2ms
memory: 4120kb
input:
100 463755411 944924051 569275585 105851172 592153841 91544136 292173792 428888055 158065382 558253600 439736157 506672999 47397359 619019563 132582507 105430189 278076143 958768690 422012936 222099461 202575047 384281951 614566231 671343976 294810954 392832692 473513518 851348781 962727771 76711759...
output:
463858397
result:
ok 1 number(s): "463858397"
Test #6:
score: 0
Accepted
time: 91ms
memory: 5584kb
input:
500 63960114 183782537 442536074 69052219 627948420 566608308 389792509 708557223 427609884 202941344 320587718 99402907 191317477 77691343 24361285 874585489 623972704 102805705 482868933 83438813 410709971 664263694 677872859 696812482 131770155 786035224 370572727 267276740 784413151 962863577 42...
output:
158716699
result:
ok 1 number(s): "158716699"
Test #7:
score: 0
Accepted
time: 9ms
memory: 4776kb
input:
255 1 2 1000000000 5 1000000000 1000000000 1000000000 14 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 41 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...
output:
2194
result:
ok 1 number(s): "2194"
Test #8:
score: 0
Accepted
time: 13ms
memory: 4840kb
input:
255 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...
output:
2194
result:
ok 1 number(s): "2194"
Test #9:
score: 0
Accepted
time: 13ms
memory: 4604kb
input:
255 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...
output:
4382
result:
ok 1 number(s): "4382"
Test #10:
score: 0
Accepted
time: 14ms
memory: 4736kb
input:
255 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 338 1000000000 1000000000 1000000000 1000000000 1000000000 100000...
output:
8866
result:
ok 1 number(s): "8866"
Test #11:
score: 0
Accepted
time: 14ms
memory: 4648kb
input:
255 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 709 1000000000 1000000000 1000000000 100000...
output:
11828
result:
ok 1 number(s): "11828"
Test #12:
score: 0
Accepted
time: 88ms
memory: 5828kb
input:
500 775569890 883044263 328734460 466486572 302507053 815519321 93545015 885070613 773557090 695957099 552621466 418667791 693030854 786098118 654509624 912224692 395701552 645077192 539451385 709674680 954861640 622228580 593685972 950369532 755544960 119338648 214560853 663876156 685061220 9648292...
output:
2041258801
result:
ok 1 number(s): "2041258801"
Test #13:
score: 0
Accepted
time: 95ms
memory: 5832kb
input:
500 928632098 980261733 606569266 893647366 902137782 654845673 862516393 956069235 294013902 809794475 990877432 822443827 830058301 885331221 691214131 846766810 681577062 877403075 902548297 606900585 625960107 773503955 542198313 455785454 391407338 832907154 988574953 979703580 966194394 863880...
output:
5067497466
result:
ok 1 number(s): "5067497466"
Test #14:
score: 0
Accepted
time: 90ms
memory: 5776kb
input:
500 868548562 910631480 899812583 809351669 943753167 868434016 950018265 879409577 822603337 729802349 916929670 957020181 619382566 938452119 997442047 871254037 693858164 811810620 556786248 893851663 858889659 614946508 567260147 353194914 931411218 853815775 776203182 688317928 913074820 962751...
output:
6600036435
result:
ok 1 number(s): "6600036435"
Test #15:
score: 0
Accepted
time: 98ms
memory: 5800kb
input:
500 762310371 916768912 991941519 980262072 932034923 960520510 957145919 907703325 994026193 794283688 978244901 957999792 967129963 977154193 924739389 943024585 899022898 993423330 969333588 917547741 911575912 969076315 893276920 914200390 858274554 873994021 982190755 980640534 933400450 942398...
output:
8117644140
result:
ok 1 number(s): "8117644140"
Test #16:
score: 0
Accepted
time: 91ms
memory: 5768kb
input:
500 165793680 50651212 254850722 177817411 359164684 280758390 648167581 258957978 132214254 83688797 21876822 348206054 6991594 578699721 526246458 6536552 786603150 511605061 472824213 553359829 433993012 251106793 520466234 5168349 578133791 626608835 100829874 365803371 748120884 308407388 87662...
output:
84898654
result:
ok 1 number(s): "84898654"
Test #17:
score: 0
Accepted
time: 88ms
memory: 5624kb
input:
500 166178429 214887443 5821468 448269933 116209322 193167388 313504841 288296580 52006657 98081138 694672356 157071131 165963606 48257284 37596890 330763385 505027673 23716870 18644280 326201887 217336710 100124192 106113520 381402625 372303260 176078040 491273676 51842829 546335769 763895016 82061...
output:
62541096
result:
ok 1 number(s): "62541096"
Test #18:
score: 0
Accepted
time: 89ms
memory: 5696kb
input:
500 166563178 2503909 160234191 89253084 16175702 50346702 112904457 16935996 350220613 209962873 516790886 96822105 136540700 3491700 7113642 45854762 84904626 159731970 39456329 352319666 325193296 93108759 424380957 140055099 27080278 328596520 46089728 35853010 65292051 50496288 160620024 550536...
output:
13141872
result:
ok 1 number(s): "13141872"
Test #19:
score: 0
Accepted
time: 86ms
memory: 5632kb
input:
500 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...
output:
773
result:
ok 1 number(s): "773"
Test #20:
score: 0
Accepted
time: 86ms
memory: 5764kb
input:
500 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...
output:
1982
result:
ok 1 number(s): "1982"
Test #21:
score: 0
Accepted
time: 92ms
memory: 5816kb
input:
500 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...
output:
1766
result:
ok 1 number(s): "1766"
Test #22:
score: 0
Accepted
time: 92ms
memory: 5696kb
input:
500 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...
output:
1405
result:
ok 1 number(s): "1405"
Extra Test:
score: 0
Extra Test Passed