# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1036896 |
2024-07-27T19:16:02 Z |
XJP12 |
Catfish Farm (IOI22_fish) |
C++17 |
|
19 ms |
8268 KB |
#include <bits/stdc++.h>
#include "fish.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
ll max_weights(int n, int m, vi x, vi y, vi w){
ll dp[n][4];
vector<ll> v(n,0);
for(int i=0; i<m; i++){
v[x[i]] = w[i];
}
if(n==2){
return max(w[0], w[1]);
}
for(int i=2; i<n; i++){
if(i==2){
dp[i][0]=0;
dp[i][1]=v[i]+v[i-2];
dp[i][2]=v[i-1];
dp[i][3]=v[i];
continue;
}
dp[i][0]=max(dp[i-1][0], dp[i-1][2]);
dp[i][1]=max(dp[i-1][0]+v[i-2] + v[i], dp[i-1][2] + v[i]);
dp[i][2]=max(dp[i-1][1], dp[i-1][3]);
dp[i][3]=max(dp[i-1][1]+ v[i]-v[i-1], dp[i-1][3] + v[i]-v[i-1]);
}
return max({dp[n-1][0], dp[n-1][1], dp[n-1][2],dp[n-1][3]});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
7092 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 |
348 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 |
4188 KB |
Output is correct |
2 |
Correct |
2 ms |
4188 KB |
Output is correct |
3 |
Correct |
12 ms |
5976 KB |
Output is correct |
4 |
Correct |
8 ms |
5836 KB |
Output is correct |
5 |
Correct |
19 ms |
8252 KB |
Output is correct |
6 |
Correct |
16 ms |
7516 KB |
Output is correct |
7 |
Correct |
19 ms |
8268 KB |
Output is correct |
8 |
Correct |
19 ms |
8036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 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 |
348 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 |
348 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 |
4188 KB |
Output is correct |
2 |
Correct |
2 ms |
4188 KB |
Output is correct |
3 |
Correct |
12 ms |
5976 KB |
Output is correct |
4 |
Correct |
8 ms |
5836 KB |
Output is correct |
5 |
Correct |
19 ms |
8252 KB |
Output is correct |
6 |
Correct |
16 ms |
7516 KB |
Output is correct |
7 |
Correct |
19 ms |
8268 KB |
Output is correct |
8 |
Correct |
19 ms |
8036 KB |
Output is correct |
9 |
Incorrect |
18 ms |
8020 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 |
14 ms |
7092 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |