// komak!
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << "(" << (#x) << "): " << (x) << endl;
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn5 = 3e5 + 10;
ll av[maxn5];
ll dp[maxn5][2];
long long max_weights(int n, int m, std::vector<int> x, std::vector<int> y,
std::vector<int> w) {
for(int i = 0; i < m; i++){
av[x[i]] = w[i];
}
ll ans = 0;
dp[0][0] = dp[0][1] = 0;
for(int i = 1; i < n; i++){
dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + av[i]);
dp[i][1] = max(dp[i - 1][1], (i >= 2 ? max(dp[i - 2][0], dp[i - 2][1]) : 0) + av[i - 1]);
ans = max({ans, dp[i][0], dp[i][1]});
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
3564 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 |
0 ms |
212 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 |
2 ms |
1876 KB |
Output is correct |
2 |
Correct |
1 ms |
1876 KB |
Output is correct |
3 |
Correct |
16 ms |
3636 KB |
Output is correct |
4 |
Correct |
10 ms |
3804 KB |
Output is correct |
5 |
Correct |
24 ms |
6600 KB |
Output is correct |
6 |
Correct |
21 ms |
5968 KB |
Output is correct |
7 |
Correct |
24 ms |
6456 KB |
Output is correct |
8 |
Correct |
24 ms |
6528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 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 |
0 ms |
212 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 |
0 ms |
212 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 |
2 ms |
1876 KB |
Output is correct |
2 |
Correct |
1 ms |
1876 KB |
Output is correct |
3 |
Correct |
16 ms |
3636 KB |
Output is correct |
4 |
Correct |
10 ms |
3804 KB |
Output is correct |
5 |
Correct |
24 ms |
6600 KB |
Output is correct |
6 |
Correct |
21 ms |
5968 KB |
Output is correct |
7 |
Correct |
24 ms |
6456 KB |
Output is correct |
8 |
Correct |
24 ms |
6528 KB |
Output is correct |
9 |
Incorrect |
28 ms |
6220 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
3564 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |