#include "fish.h"
//#include <vector>
#include<bits/stdc++.h>
using namespace std;
int n,m;
long long arr[305][305],dp0[305][305],dp1[305][305],dp2[305][305];
long long max_weights(int N, int M, vector<int> X, vector<int> Y,
vector<int> W) {
n=N,m=M;
for(int i=0;i<m;++i){
++X[i],++Y[i];
arr[X[i]][Y[i]]=W[i];
}
for(int i=1;i<=n;++i){
for(int j=1;j<=n;++j){
dp0[i][j]=arr[i][j]+dp0[i][j-1];
}
}
for(int i=1;i<=n;++i){
for(int j=0;j<=n;++j){
for(int k=0;k<=n;++k){
if(k==j){
dp1[i][j]=max(dp1[i][j],dp1[i-1][k]);
}
else if(k<j){
dp1[i][j]=max(dp1[i][j],dp1[i-1][k]+dp0[i-1][j]-dp0[i-1][k]);
}
else{
dp1[i][j]=max(dp1[i][j],dp1[i-1][k]+dp0[i][k]-dp0[i][j]);
}
}
}
}
long long ans=0;
for(int j=0;j<=n;++j) ans=max(ans,dp1[n][j]);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
26 ms |
9812 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2648 KB |
1st lines differ - on the 1st token, expected: '2', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
4696 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
1st lines differ - on the 1st token, expected: '3', found: '4' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
1st lines differ - on the 1st token, expected: '3', found: '4' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
1st lines differ - on the 1st token, expected: '3', found: '4' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
4696 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
26 ms |
9812 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |