QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#621364 | #7318. Cute Panda | rotcar07 | AC ✓ | 490ms | 27144kb | C++20 | 553b | 2024-10-08 13:53:50 | 2024-10-08 13:53:51 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int maxn=2e6+5;
int n,a[maxn];
typedef long long ll;
ll dp[maxn];
int main(){
while(cin>>n){
for(int i=1;i<=n;i++) cin>>a[i*2];
for(int i=1;i<=n;i++) cin>>a[i*2-1];
n<<=1;
dp[2]=dp[1]=a[1];
for(int i=3;i<=n;i++) dp[i]=min(dp[i-1],dp[i-2])+a[i-1];
ll ans=dp[n];
dp[0]=1e18;dp[1]=a[n];
for(int i=2;i<=n;i++) dp[i]=min(dp[i-1],dp[i-2])+a[i-1];
ans=min({ans,dp[n-1],dp[n]});
cout<<ans<<'\n';
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 5648kb
input:
5 8 4 8 3 10 1 0 4 5 1 5 9 4 10 0 4 3 5 2 2 1
output:
11 13
result:
ok 2 number(s): "11 13"
Test #2:
score: 0
Accepted
time: 7ms
memory: 5696kb
input:
5 6 1 9 8 5 3 1 1 5 5 5 8 7 4 3 6 3 4 3 1 5 5 5 1 4 1 2 5 2 3 0 5 5 7 4 7 5 2 5 3 3 4 1 5 4 1 2 5 5 2 4 1 5 5 5 6 8 4 6 9 4 4 3 3 1 5 3 10 0 6 0 3 1 4 1 3 5 0 6 5 9 10 4 1 5 1 1 5 0 8 1 5 6 0 0 1 4 4 5 4 7 8 8 2 2 1 1 4 1 5 0 10 3 3 8 3 4 3 4 5 5 10 5 9 10 9 4 4 0 2 4 5 8 0 1 7 6 5 3 3 3 3 5 0 6 9 5...
output:
15 16 12 16 17 15 12 12 9 9 19 14 15 7 16 13 15 9 10 18 11 11 12 14 11 8 12 10 8 12 17 13 20 6 16 17 8 14 17 5 12 11 16 15 12 5 12 13 12 16 13 12 1 14 13 8 12 10 11 14 4 5 15 11 12 7 10 9 13 13 9 16 8 12 8 13 14 18 5 13 16 13 10 16 20 12 18 8 12 11 12 18 5 15 13 12 5 14 15 7 17 12 7 15 16 9 16 16 15...
result:
ok 10000 numbers
Test #3:
score: 0
Accepted
time: 485ms
memory: 5720kb
input:
1000 505400698 561631395 579040098 886128990 488693308 406350856 380132470 800540368 831995897 667148414 998126004 837581553 522169132 877906199 649428493 388771071 378257450 295374091 898831314 973238373 612608464 761814602 765355873 663781699 127645193 268211920 957441374 326023570 225808435 80953...
output:
241596246615 239054515809 237452474136 246903933900 241282544302 242104329619 240066695690 246119248887 241112008573 245966654656 244026959498 246283289370 251243657583 244791515307 244421557959 239596779090 235625008293 242476505519 239535819157 246948121244 242694804613 250655883617 243801913290 2...
result:
ok 1000 numbers
Test #4:
score: 0
Accepted
time: 490ms
memory: 27028kb
input:
1000000 990475794 27883048 871667983 124588829 27219211 275646172 492386284 156111116 583686048 458879572 324638816 591432415 910198602 997533820 722345389 724196743 751407279 173924401 110737634 870103307 159093589 861025107 716720227 799679501 317046092 4777744 964329290 212597009 370832539 153943...
output:
242508281779627
result:
ok 1 number(s): "242508281779627"
Test #5:
score: 0
Accepted
time: 488ms
memory: 27092kb
input:
1000000 514553487 588214291 66760191 531607528 23649023 834683744 506700096 22427487 941951952 128242155 592521241 820994810 156828165 395495052 144314610 661944676 380711369 879876750 753706149 465136380 421227083 512192596 313903731 216421471 542939600 800831300 36175211 663819309 862895094 670153...
output:
242573621401403
result:
ok 1 number(s): "242573621401403"
Test #6:
score: 0
Accepted
time: 485ms
memory: 27092kb
input:
1000000 986777960 356937958 770862929 549124802 417588584 362186334 348964879 950779769 495222444 372112201 394065565 598976356 454664102 172441742 98141091 950510623 268299256 713901584 695104985 256638848 840249821 696729738 215870283 796199167 594096770 803480499 629451372 340570650 974042803 686...
output:
242272836294306
result:
ok 1 number(s): "242272836294306"
Test #7:
score: 0
Accepted
time: 477ms
memory: 27108kb
input:
1000000 869067849 789225138 401336738 271674784 442931926 553252435 191229663 879132050 343460229 615982248 827013669 671925195 457532746 285824921 10498375 239076569 819450656 621555346 267907601 384577804 964305266 249863100 117836836 81009570 940221232 469693210 927760242 648725772 85190510 70251...
output:
242373686494571
result:
ok 1 number(s): "242373686494571"
Test #8:
score: 0
Accepted
time: 484ms
memory: 26968kb
input:
1000000 46325029 926545025 400406766 657788277 836871488 80755025 402090666 102451622 191698013 859852294 628557993 81310522 755368682 62771611 259292148 601271444 2005834 750547473 135677509 176080272 383328003 802996463 19803388 660787267 286345693 135905920 226069110 956880894 122709291 718688448...
output:
242339210241093
result:
ok 1 number(s): "242339210241093"
Test #9:
score: 0
Accepted
time: 489ms
memory: 27144kb
input:
1000000 928614919 768897620 735913284 380338259 935843757 608257616 949388158 735836613 744968507 103722339 430102317 154259360 53204617 176154791 876682141 889837391 889593723 658201235 708480127 967582741 170946959 987533606 553173721 314193890 337502863 433522411 819345271 633632234 938889708 324...
output:
242523313894317
result:
ok 1 number(s): "242523313894317"
Test #10:
score: 0
Accepted
time: 485ms
memory: 27084kb
input:
1000000 400839391 201184799 366387093 397855533 256154390 799323718 455216453 664188894 224610071 347592385 936679349 637273616 687477043 658134190 125475913 178403337 440745121 492226069 576250035 95521697 589969697 540666967 160172982 893971586 757256253 509800539 117654139 941787356 976408488 972...
output:
242674231178511
result:
ok 1 number(s): "242674231178511"
Extra Test:
score: 0
Extra Test Passed