#include<bits/stdc++.h>
//#include "insects.h"
#define f first
#define s second
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
//#define sz(x) (ll)x.size()
#define all(x) x.begin(),x.end()
using namespace std;
ll dpl[3001][3001]{0};
ll dpr[3001][3001]{0};
ll mp[3001][3001]{0};
ll max_weights(int N, int M,vector<int> X,vector<int> Y,vector<int> W) {
for(int i=0;i<M;i++){
mp[Y[i]+1][X[i]+1]+=W[i];
}ll ans=0;
for(int i=1;i<=N;i++)for(int j=1;j<=N;j++)mp[i][j]+=mp[i-1][j];
for(int i=1;i<=N;i++){
for(int j=0;j<=N;j++){
dpl[j][i]=0;
for(int k=0;k<=j;k++){
dpl[j][i] = max(dpl[k][i-1]+max(mp[j][i-1]-mp[k][i-1],1ll*0),dpl[j][i]);
}
}
}
for(int i=N;i>=1;i--){
for(int j=0;j<=N;j++){
dpr[j][i]=0;
for(int k=0;k<=j;k++){
dpr[j][i] = max(dpr[k][i+1]+max(mp[j][i+1]-mp[k][i+1],1ll*0),dpr[j][i]);
}
}
}
for(int i=1;i<=N;i++){
for(int j=0;j<=N;j++){
ans=max(ans,dpl[j][i]+dpr[j][i]);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
23 ms |
4188 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Runtime error |
45 ms |
8276 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
802 ms |
429268 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4448 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
4440 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
4440 KB |
Output is correct |
6 |
Correct |
1 ms |
4444 KB |
Output is correct |
7 |
Correct |
1 ms |
4444 KB |
Output is correct |
8 |
Correct |
1 ms |
4444 KB |
Output is correct |
9 |
Incorrect |
6 ms |
14684 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '7818664569' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4448 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
4440 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
4440 KB |
Output is correct |
6 |
Correct |
1 ms |
4444 KB |
Output is correct |
7 |
Correct |
1 ms |
4444 KB |
Output is correct |
8 |
Correct |
1 ms |
4444 KB |
Output is correct |
9 |
Incorrect |
6 ms |
14684 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '7818664569' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4448 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
4440 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
4440 KB |
Output is correct |
6 |
Correct |
1 ms |
4444 KB |
Output is correct |
7 |
Correct |
1 ms |
4444 KB |
Output is correct |
8 |
Correct |
1 ms |
4444 KB |
Output is correct |
9 |
Incorrect |
6 ms |
14684 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '7818664569' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
802 ms |
429268 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
23 ms |
4188 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |