#include "fish.h"
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
#include <vector>
using namespace std;
const int NMAX = 3005;
ll dp[NMAX][NMAX];//klebadi
ll DP[NMAX][NMAX];//zrdadi
ll val[NMAX][NMAX];
const ll linf = 1e18;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,std::vector<int> W) {
int n = N;
int m = M;
for(int i = 0; i < m; i++){
val[X[i] + 1][Y[i] + 1] = W[i];
}
/*for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++) cout << val[i][j] << ' ';
cout << "\n";
}*/
for(int i = 0; i <= n; i++) {
for(int j = 0; j <= n; j++){
dp[i][j] = -linf;
//DP[i][j] = -linf;
}
}
DP[0][0] = 0;
for(int i = 1; i <= n + 1; i++){
for(int j = n; j >= 1; j--){
if(j == n){
if(i > 1) dp[i][j] = DP[i - 2][j] + val[i][j];
}
else dp[i][j] = max(dp[i - 1][j + 1], dp[i][j + 1]) + val[i][j];
}
for(int j = 1; j <= n; j++){
if(j == 1)DP[i][j] = dp[i - 1][j] + val[i][j];
else DP[i][j] = max(DP[i - 1][j - 1], DP[i][j - 1]) + val[i][j];
}
}
return dp[n + 1][1];
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
308 ms |
149056 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
1st lines differ - on the 1st token, expected: '2', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
302 ms |
143824 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
368 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
368 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
368 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
302 ms |
143824 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
308 ms |
149056 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |