#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long// !
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define F first
#define S second
const int MAXN = 1e5 + 3;
ll dp[MAXN][2];
ll a[MAXN];
ll max_weights(int n, int m, vector<int> X, std::vector<int> Y, vector<int> W) {
// dp[i][j], for i'th column just before the j'th element
vector<pair<int, int>> pos[MAXN];
for (int i = 0; i < m; i++){
a[X[i]+1] = W[i];
pos[X[i]+1].push_back({Y[i], W[i]});
}
for (int i = 1; i <= n; i++){
dp[i][0] = max(dp[i-1][1] + a[i], dp[i-1][0]);
dp[i][1] = max(dp[i-1][0], dp[i-1][1]);
}
return max(dp[n][0], dp[n][1]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
6596 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2648 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4188 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Incorrect |
20 ms |
7744 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2648 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2648 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2648 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4188 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Incorrect |
20 ms |
7744 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
6596 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |