ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#183163 | #3288. 恐狼前锋 | quliannanyishou | 100 | 11ms | 1392kb | C++11 | 602b | 2023-08-08 09:46:59 | 2023-08-08 12:34:07 |
answer
#include<bits/stdc++.h>
using namespace std;
long long m,a[10010],b[10010],dp[10010],ans=1e18,min1;
inline long long read()
{
long long x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0' && ch<='9')
x=x*10+ch-'0',ch=getchar();
return x*f;
}
int main()
{
m=read();
for(int i=1;i<=m;++i)
{
a[i]=read();
}
for(int i=1;i<=m;++i)
{
b[i]=read();
}
dp[1]=a[1];
for(int i=2;i<=m;++i)
{
dp[i]=dp[i-1]+a[i]+min(b[i],b[i-1]);
}
cout<<dp[m]<<endl;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
10 3 94 1981507 458857175 9 59165925 1 2591835 3622 16246 887096 695983 866 16 18 4212 405537627 102...
output:
523419627
result:
ok 1 number(s): "523419627"
Test #2:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
20 72 23 44 571921 1 7 4088128 677 508275894 458 8 88 7039 129116 5459 41858 12 15034308 192588188 1...
output:
769905926
result:
ok 1 number(s): "769905926"
Test #3:
score: 10
Accepted
time: 0ms
memory: 1172kb
input:
20 816 1 713239 32 1349392 3583 736305 706582161 80384 50465424 102 148 23346 1109 410639 27041 6765...
output:
1100807877
result:
ok 1 number(s): "1100807877"
Test #4:
score: 10
Accepted
time: 1ms
memory: 1176kb
input:
300 15 457 6004301 162473 9891 5 370410 2 7554233 957070 80775871 65 223203 30047785 1498968 1432 52...
output:
20024146273
result:
ok 1 number(s): "20024146273"
Test #5:
score: 10
Accepted
time: 1ms
memory: 1172kb
input:
300 1804 1732 427119741 3 450 2969441 3 1531710 124480 122087994 168990 1138758 3539 191721482 99978...
output:
14909163981
result:
ok 1 number(s): "14909163981"
Test #6:
score: 10
Accepted
time: 3ms
memory: 1388kb
input:
10000 45954200 9129 2152508 82 1976 28144715 22104 6592557 5002 44816 24699941 493469 653725 593399 ...
output:
617010943618
result:
ok 1 number(s): "617010943618"
Test #7:
score: 10
Accepted
time: 0ms
memory: 1392kb
input:
10000 9 582862 10895 575 1985 441608153 5794798 375427472 51382033 110855379 1360116 3214434 3369039...
output:
587536058523
result:
ok 1 number(s): "587536058523"
Test #8:
score: 10
Accepted
time: 3ms
memory: 1388kb
input:
10000 66999672 3958 8638582 6362 132947 3194964 21832 19303 41925606 60751 2 54059846 37542 75434693...
output:
585460842807
result:
ok 1 number(s): "585460842807"
Test #9:
score: 10
Accepted
time: 3ms
memory: 1392kb
input:
10000 40523 219765023 92678708 3 14 328202 326 58 610 4 38 28489100 4 389479 132199512 238106 22 868...
output:
593364318702
result:
ok 1 number(s): "593364318702"
Test #10:
score: 10
Accepted
time: 0ms
memory: 1388kb
input:
10000 57 101990 1775347 523038233 188544533 274 1167 28186 103 16418004 205401 1182379 6955 843 693 ...
output:
588056388069
result:
ok 1 number(s): "588056388069"