#include "fish.h"
#include "bits/stdc++.h"
#define int long long
using namespace std;
int dp[3011][3012];
int vct[3012][3011];
int slv(int a,int b){
if(a==3000)return 0;
if(dp[a][b]!=-1)return dp[a][b];
// cerr<<a<<' '<<b<<endl;
int mx=0;
int tot=0;
for(int i=0;i<=3000;i++){
if(a&&b<i)tot+=vct[a-1][i];
tot+=vct[a+1][i];
tot-=vct[a][i];
mx=max(mx,slv(a+1,i)+tot);
}
return dp[a][b]=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]][y[i]+1]=w[i];
}
return slv(0,0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
2600 KB |
Output is correct |
2 |
Correct |
23 ms |
3392 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
68 ms |
8076 KB |
Output is correct |
6 |
Correct |
72 ms |
7976 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1090 ms |
71636 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
12 ms |
1864 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
71708 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
71708 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
71708 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
12 ms |
1864 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
2600 KB |
Output is correct |
2 |
Correct |
23 ms |
3392 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
68 ms |
8076 KB |
Output is correct |
6 |
Correct |
72 ms |
7976 KB |
Output is correct |
7 |
Execution timed out |
1090 ms |
71636 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |