#include "fish.h"
#include "bits/stdc++.h"
using namespace std;
long long 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(int n, int m, std::vector<int> x, std::vector<int> y, std::vector<int> 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);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
3540 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '709728670' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
71112 KB |
Output is correct |
2 |
Incorrect |
36 ms |
5356 KB |
1st lines differ - on the 1st token, expected: '40604614618209', found: '1040403569' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Incorrect |
12 ms |
2516 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '-316184074' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
71076 KB |
Output is correct |
2 |
Correct |
27 ms |
71072 KB |
Output is correct |
3 |
Incorrect |
22 ms |
71052 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
71076 KB |
Output is correct |
2 |
Correct |
27 ms |
71072 KB |
Output is correct |
3 |
Incorrect |
22 ms |
71052 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
71076 KB |
Output is correct |
2 |
Correct |
27 ms |
71072 KB |
Output is correct |
3 |
Incorrect |
22 ms |
71052 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Incorrect |
12 ms |
2516 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '-316184074' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
3540 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '709728670' |
2 |
Halted |
0 ms |
0 KB |
- |