# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
785101 |
2023-07-17T05:16:36 Z |
khshg |
Catfish Farm (IOI22_fish) |
C++17 |
|
27 ms |
6192 KB |
#include<bits/stdc++.h>
using namespace std;
long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
long long ans = 0;
vector<int> c(N + 1);
for(int i = 0; i < M; ++i) {
c[X[i]] = W[i];
}
vector<array<long long, 2>> dp(N + 1);
dp[0][0] = 0;
dp[0][1] = c[1];
ans = c[1];
for(int i = 1; i < N; ++i) {
dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]);
dp[i][1] = dp[i - 1][1] - c[i];
dp[i][1] = max(dp[i][1], (i - 2 < 0 ? 0 : dp[i - 2][0]) + c[i - 1]);
dp[i][1] = max(dp[i][1], (i - 2 < 0 ? 0 : dp[i - 2][1]));
dp[i][1] += c[i + 1];
ans = max(dp[i][0], dp[i][1]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
3924 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 |
1 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 |
2260 KB |
Output is correct |
2 |
Correct |
1 ms |
2260 KB |
Output is correct |
3 |
Correct |
15 ms |
3244 KB |
Output is correct |
4 |
Correct |
10 ms |
3636 KB |
Output is correct |
5 |
Correct |
26 ms |
6192 KB |
Output is correct |
6 |
Correct |
23 ms |
5544 KB |
Output is correct |
7 |
Correct |
24 ms |
6104 KB |
Output is correct |
8 |
Correct |
23 ms |
6100 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 |
2260 KB |
Output is correct |
2 |
Correct |
1 ms |
2260 KB |
Output is correct |
3 |
Correct |
15 ms |
3244 KB |
Output is correct |
4 |
Correct |
10 ms |
3636 KB |
Output is correct |
5 |
Correct |
26 ms |
6192 KB |
Output is correct |
6 |
Correct |
23 ms |
5544 KB |
Output is correct |
7 |
Correct |
24 ms |
6104 KB |
Output is correct |
8 |
Correct |
23 ms |
6100 KB |
Output is correct |
9 |
Incorrect |
27 ms |
5944 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 |
3924 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |