10524 | 2024-04-04 15:58:55 | 111 | Jobstown-i milliomos | cpp17 | Wrong answer 25/100 | 187ms | 8540 KiB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,M;
cin>>N>>M;
vector<int>v(N),p(501),dp(250501);
for(int i=0;i<N;i++){
cin>>v[i];
}
for(int i=0;i<N;i++){
int x;
cin>>x;
p[v[i]]=max(p[v[i]],x);
}
for(int i=1;i<=500;i++){
p[i]=max(p[i],p[i-1]);
}
for(int i=0;i<250000;i++){
for(int j=0;j<500;j++){
dp[i+j]=max(dp[i+j],dp[i]+p[j]);
}
}
cout<<dp[min(M,250000ll)]<<'\n';
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 187ms | 5764 KiB | ||||
2 | Accepted | 187ms | 6068 KiB | ||||
subtask2 | 25/25 | ||||||
3 | Accepted | 187ms | 6188 KiB | ||||
4 | Accepted | 187ms | 6140 KiB | ||||
5 | Accepted | 187ms | 6144 KiB | ||||
6 | Accepted | 187ms | 6184 KiB | ||||
7 | Accepted | 187ms | 6464 KiB | ||||
8 | Accepted | 187ms | 6744 KiB | ||||
9 | Accepted | 187ms | 6972 KiB | ||||
10 | Accepted | 187ms | 7412 KiB | ||||
11 | Accepted | 186ms | 7356 KiB | ||||
12 | Accepted | 187ms | 7304 KiB | ||||
13 | Accepted | 187ms | 7076 KiB | ||||
14 | Accepted | 187ms | 7332 KiB | ||||
subtask3 | 0/16 | ||||||
15 | Wrong answer | 187ms | 7288 KiB | ||||
16 | Wrong answer | 186ms | 7576 KiB | ||||
17 | Wrong answer | 187ms | 7828 KiB | ||||
18 | Wrong answer | 187ms | 7776 KiB | ||||
19 | Wrong answer | 186ms | 7772 KiB | ||||
20 | Wrong answer | 187ms | 7956 KiB | ||||
21 | Wrong answer | 187ms | 7984 KiB | ||||
subtask4 | 0/59 | ||||||
22 | Accepted | 187ms | 7992 KiB | ||||
23 | Accepted | 187ms | 7996 KiB | ||||
24 | Wrong answer | 187ms | 7956 KiB | ||||
25 | Wrong answer | 187ms | 7988 KiB | ||||
26 | Wrong answer | 187ms | 8276 KiB | ||||
27 | Wrong answer | 186ms | 8200 KiB | ||||
28 | Wrong answer | 187ms | 8160 KiB | ||||
29 | Wrong answer | 186ms | 8288 KiB | ||||
30 | Wrong answer | 187ms | 8232 KiB | ||||
31 | Wrong answer | 187ms | 8540 KiB | ||||
32 | Wrong answer | 186ms | 8480 KiB | ||||
33 | Wrong answer | 186ms | 8480 KiB |