#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debug_out(){cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
cerr << H << ' ';
debug_out(T...);
}
#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)
const int maxn = 3e5 + 10;
int w[maxn];
ll dp[maxn];
ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
for (int i = 0; i < M; i++){
w[X[i]] = W[i];
}
dp[0] = 0;
for (int i = 1; i < N; i++){
dp[i] = w[i-1];
if (i > 1){
dp[i] += dp[i-2];
}
if (i > 2){
dp[i] = max(dp[i], dp[i-3] + w[i-2] + w[i-1]);
}
dp[i] = max(dp[i], dp[i-1]);
}
return max(dp[N-1], dp[N-2] + w[N-1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
2900 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 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 |
980 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
14 ms |
2616 KB |
Output is correct |
4 |
Correct |
9 ms |
2772 KB |
Output is correct |
5 |
Correct |
23 ms |
5440 KB |
Output is correct |
6 |
Correct |
27 ms |
4668 KB |
Output is correct |
7 |
Correct |
23 ms |
5320 KB |
Output is correct |
8 |
Correct |
23 ms |
5364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
14 ms |
2616 KB |
Output is correct |
4 |
Correct |
9 ms |
2772 KB |
Output is correct |
5 |
Correct |
23 ms |
5440 KB |
Output is correct |
6 |
Correct |
27 ms |
4668 KB |
Output is correct |
7 |
Correct |
23 ms |
5320 KB |
Output is correct |
8 |
Correct |
23 ms |
5364 KB |
Output is correct |
9 |
Incorrect |
20 ms |
5188 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
2900 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |