#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
const int maxn = 1e5 + 2;
int64 dp [maxn][2];
int64 p [maxn];
int64 max_weights(int n, int m, vector<int> x, vector<int> y,
vector<int> w) {
for (int i = 0; i < m; i++) {
p[x[i] + 1] = w[i];
}
dp[1][0] = 0;
dp[1][1] = p[2];
dp[2][0] = p[2];
dp[2][1] = p[1] + p[3];
for (int i = 3; i <= n; i++){
dp[i][0] = max(dp[i-1][1], dp[i-1][0]);
dp[i][1] = max({dp[i-2][0] + p[i-1] + p[i+1], dp[i-2][1] + p[i + 1], dp[i-1][1] - p[i] + p[i+1]});
}
return max(dp[n][0], dp[n][1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
4700 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1748 KB |
Output is correct |
2 |
Correct |
1 ms |
1748 KB |
Output is correct |
3 |
Correct |
16 ms |
4288 KB |
Output is correct |
4 |
Correct |
11 ms |
3276 KB |
Output is correct |
5 |
Correct |
25 ms |
4984 KB |
Output is correct |
6 |
Correct |
23 ms |
5604 KB |
Output is correct |
7 |
Correct |
31 ms |
6240 KB |
Output is correct |
8 |
Correct |
29 ms |
6228 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1748 KB |
Output is correct |
2 |
Correct |
1 ms |
1748 KB |
Output is correct |
3 |
Correct |
16 ms |
4288 KB |
Output is correct |
4 |
Correct |
11 ms |
3276 KB |
Output is correct |
5 |
Correct |
25 ms |
4984 KB |
Output is correct |
6 |
Correct |
23 ms |
5604 KB |
Output is correct |
7 |
Correct |
31 ms |
6240 KB |
Output is correct |
8 |
Correct |
29 ms |
6228 KB |
Output is correct |
9 |
Incorrect |
34 ms |
5544 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
4700 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |