#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int max_weights(int32_t N, int32_t M, vector<int32_t> X, vector<int32_t> Y, vector<int32_t> W) {
int n = N, m = M;
vector<vector<int>> c(1, vector<int>(n+1, 0));
vector<vector<int>> dp(9, vector<int>(n+1, 0));
for (int i = 0; i < m; i++) {
c[Y[i]][X[i]] = W[i];
}
for (int j = 0; j < n; j++) {
if (j-1 >= 0) {
dp[0][j] = max(dp[0][j], dp[0][j-1]+c[0][j]);
dp[0][j] = max(dp[0][j], dp[0][j-1]);
dp[1][j] = max(dp[1][j], dp[1][j-1]);
}
if (j == 1) {
dp[1][j] = max(dp[1][j], dp[0][j-1]+c[0][j-1]);
}
if (j-2 >= 0) {
dp[1][j] = max(dp[1][j], dp[0][j-2]+c[0][j-1]);
dp[1][j] = max(dp[1][j], dp[1][j-2]+c[0][j-1]);
}
}
return max(dp[0][n-1], dp[1][n-1]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
26 ms |
20124 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9036 KB |
Output is correct |
2 |
Correct |
4 ms |
9036 KB |
Output is correct |
3 |
Incorrect |
13 ms |
9368 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9036 KB |
Output is correct |
2 |
Correct |
4 ms |
9036 KB |
Output is correct |
3 |
Incorrect |
13 ms |
9368 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
26 ms |
20124 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |