#include "fish.h"
#include "bits/stdc++.h"
#define int long long
using namespace std;
int dp[3001][3002];
vector<pair<int,int>>vct[3001];
int slv(int a,int b){
if(dp[a][b]!=-1)return dp[a][b];
int mx=slv(a+1,0);
int tot=0;
for(auto &i:vct[a]){
if(i.first>b)tot+=i.second;
mx=max(slv(a+1,i.first)+tot,mx);
}
return mx;
}
long long max_weights(int32_t n, int32_t m, std::vector<int32_t> x, std::vector<int32_t> y, std::vector<int32_t> w) {
if(n>3000){
int g=0;
for(auto &i:w)g+=i;
return g;
}
memset(dp,-1,sizeof dp);
for(int i=0;i<m;i++){
vct[x[i]].push_back({y[i]+1,w[i]});
}
for(int i=0;i<=n;i++)sort(vct[i].begin(),vct[i].end());
return slv(0,0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
2260 KB |
Output is correct |
2 |
Correct |
22 ms |
3968 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
66 ms |
8684 KB |
Output is correct |
6 |
Correct |
68 ms |
8660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
71120 KB |
1st lines differ - on the 1st token, expected: '2', found: '206158430210' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Incorrect |
12 ms |
1536 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
71040 KB |
1st lines differ - on the 1st token, expected: '3', found: '206158430211' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
71040 KB |
1st lines differ - on the 1st token, expected: '3', found: '206158430211' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
71040 KB |
1st lines differ - on the 1st token, expected: '3', found: '206158430211' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Incorrect |
12 ms |
1536 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
2260 KB |
Output is correct |
2 |
Correct |
22 ms |
3968 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
66 ms |
8684 KB |
Output is correct |
6 |
Correct |
68 ms |
8660 KB |
Output is correct |
7 |
Incorrect |
22 ms |
71120 KB |
1st lines differ - on the 1st token, expected: '2', found: '206158430210' |
8 |
Halted |
0 ms |
0 KB |
- |