105242024-04-04 15:58:55111Jobstown-i milliomoscpp17Wrong answer 25/100187ms8540 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted187ms5764 KiB
2Accepted187ms6068 KiB
subtask225/25
3Accepted187ms6188 KiB
4Accepted187ms6140 KiB
5Accepted187ms6144 KiB
6Accepted187ms6184 KiB
7Accepted187ms6464 KiB
8Accepted187ms6744 KiB
9Accepted187ms6972 KiB
10Accepted187ms7412 KiB
11Accepted186ms7356 KiB
12Accepted187ms7304 KiB
13Accepted187ms7076 KiB
14Accepted187ms7332 KiB
subtask30/16
15Wrong answer187ms7288 KiB
16Wrong answer186ms7576 KiB
17Wrong answer187ms7828 KiB
18Wrong answer187ms7776 KiB
19Wrong answer186ms7772 KiB
20Wrong answer187ms7956 KiB
21Wrong answer187ms7984 KiB
subtask40/59
22Accepted187ms7992 KiB
23Accepted187ms7996 KiB
24Wrong answer187ms7956 KiB
25Wrong answer187ms7988 KiB
26Wrong answer187ms8276 KiB
27Wrong answer186ms8200 KiB
28Wrong answer187ms8160 KiB
29Wrong answer186ms8288 KiB
30Wrong answer187ms8232 KiB
31Wrong answer187ms8540 KiB
32Wrong answer186ms8480 KiB
33Wrong answer186ms8480 KiB