#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define sp " "
#define endl "\n"
#define pii pair<int, int>
#define st first
#define nd second
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define ll long long
#define LL node * 2
#define RR node * 2 + 1
#define MAXN 300005
const int modulo = 1e9 + 7;
const ll INF = 2e18 + 7;
ll dp[2][2][MAXN], arr[MAXN];
long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
int n = N, m = M;
for (int i = 0; i <= n; i++) arr[i] = 0;
for (int i = 0; i < m; i++) arr[X[i] + 1] = W[i];
dp[1][0][n + 1] = arr[n];
for (int i = n; i >= 1; i--){
for (int j = 0; j < 2; j++){
for (int k = 0; k < 2; k++){
dp[j][k][i] = 0;
for (int l = 0; l < 2; l++){
ll curr = dp[k][l][i + 1];
if ((j == 1 || l == 1) && k == 0) curr += arr[i - 1];
dp[j][k][i] = max(dp[j][k][i], curr);
}
}
}
}
return dp[0][0][1];
}
/*
int main() {
fileio();
int N, M;
assert(2 == scanf("%d %d", &N, &M));
std::vector<int> X(M), Y(M), W(M);
for (int i = 0; i < M; ++i) {
assert(3 == scanf("%d %d %d", &X[i], &Y[i], &W[i]));
}
long long result = max_weights(N, M, X, Y, W);
printf("%lld\n", result);
return 0;
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
8540 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
7004 KB |
Output is correct |
2 |
Correct |
1 ms |
7004 KB |
Output is correct |
3 |
Correct |
10 ms |
7996 KB |
Output is correct |
4 |
Correct |
7 ms |
8532 KB |
Output is correct |
5 |
Correct |
16 ms |
10980 KB |
Output is correct |
6 |
Correct |
13 ms |
10332 KB |
Output is correct |
7 |
Correct |
15 ms |
10956 KB |
Output is correct |
8 |
Correct |
16 ms |
10840 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
7004 KB |
Output is correct |
2 |
Correct |
1 ms |
7004 KB |
Output is correct |
3 |
Correct |
10 ms |
7996 KB |
Output is correct |
4 |
Correct |
7 ms |
8532 KB |
Output is correct |
5 |
Correct |
16 ms |
10980 KB |
Output is correct |
6 |
Correct |
13 ms |
10332 KB |
Output is correct |
7 |
Correct |
15 ms |
10956 KB |
Output is correct |
8 |
Correct |
16 ms |
10840 KB |
Output is correct |
9 |
Incorrect |
16 ms |
10588 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
13 ms |
8540 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |