ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#207885 | #3756. 氪金 | qiuqiu | 100 | 302ms | 1352kb | C++11 | 572b | 2024-08-01 09:21:54 | 2024-08-01 12:05:42 |
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#pragma GCC optimize(2)
#define INF 0x3f3f3f3f3f3f3f3f
int a[10000],b[10000],c[10000];
int f[10000];
signed main()
{
int v,n;
cin>>n>>v;
for(int i=1;i<=10000;i++)
f[i]=INF;
f[0]=0;
for(int i=1;i<=n;i++)
cin>>a[i]>>b[i]>>c[i];
for(int i=1;i<=n;i++)
for(int j=v;j>=0;j--)
{
if(j-1>=0) f[j]=min(f[j],f[j-1]+a[i]);
if(j-2>=0) f[j]=min(f[j],f[j-2]+b[i]);
if(j-3>=0) f[j]=min(f[j],f[j-3]+c[i]);
if(f[j]<0)
f[j]=INF;
}
cout<<f[v]<<endl;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1276kb
input:
10 19 25 43 45 4 14 24 32 38 49 17 29 47 15 20 46 21 29 44 16 23 44 3 36 43 12 23 46 16 22 25
output:
207
result:
ok single line: '207'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1276kb
input:
10 23 28 29 46 8 14 24 38 43 45 20 24 26 18 34 50 19 40 48 6 12 48 15 19 46 19 28 37 5 10 29
output:
250
result:
ok single line: '250'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1276kb
input:
10 27 5 16 41 9 13 15 36 46 47 5 17 34 2 11 46 1 5 18 19 25 28 35 39 48 20 34 45 5 29 40
output:
285
result:
ok single line: '285'
Test #4:
score: 10
Accepted
time: 2ms
memory: 1288kb
input:
200 240 427036 657838 749396 298365 618527 628027 428349 528817 652790 141804 460422 854755 162095 2...
output:
30545586
result:
ok single line: '30545586'
Test #5:
score: 10
Accepted
time: 1ms
memory: 1288kb
input:
200 237 375521 483421 759165 88918 143306 597322 424599 609056 748361 723374 752223 779018 640609 71...
output:
30687218
result:
ok single line: '30687218'
Test #6:
score: 10
Accepted
time: 0ms
memory: 1288kb
input:
200 370 513967 743968 790884 409190 543286 605898 63667 336942 923057 327320 397203 423043 488223 89...
output:
64588769
result:
ok single line: '64588769'
Test #7:
score: 10
Accepted
time: 99ms
memory: 1348kb
input:
3000 7284 85524758 115426324 505752134 12429051 291488711 775034760 254227206 516881688 906255233 29...
output:
1482432506136
result:
ok single line: '1482432506136'
Test #8:
score: 10
Accepted
time: 55ms
memory: 1348kb
input:
3000 3898 161797064 246791608 433818711 8165667 335935487 753536978 154845210 163255536 626512895 76...
output:
528701120806
result:
ok single line: '528701120806'
Test #9:
score: 10
Accepted
time: 60ms
memory: 1348kb
input:
3000 4057 45594024 488053571 767918809 77657192 211075988 228104479 337726140 561192252 607760601 19...
output:
553851342377
result:
ok single line: '553851342377'
Test #10:
score: 10
Accepted
time: 85ms
memory: 1352kb
input:
3000 6206 65387721 461045368 582079356 91325589 498569972 966744114 449773293 501141361 917627284 86...
output:
1151101483840
result:
ok single line: '1151101483840'
Extra Test:
score: 0
Extra Test Passed