# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
889166 |
2023-12-19T04:49:58 Z |
kim |
Catfish Farm (IOI22_fish) |
C++17 |
|
329 ms |
22868 KB |
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int N,M;
int X[300005],Y[300005],W[300005];
int W2[305][305];
ll qs[305][305],dp[305][305][2];
long long max_weights(int N_, int M_, std::vector<int> X_, std::vector<int> Y_,
std::vector<int> W_) {
N=N_,M=M_;
for(int i=1;i<=M;++i) X[i]=X_[i-1]+1,Y[i]=Y_[i-1]+1,W[i]=W_[i-1];
for(int i=1;i<=M;++i) W2[X[i]][Y[i]]=W[i];
for(int i=1;i<=N;++i) for(int j=1;j<=N;++j) qs[i][j]=qs[i][j-1]+W2[i][j];
for(int i=1;i<=N+1;++i){
for(int j=0;j<=N;++j){
for(int k=0;k<j;++k){
dp[i][j][0]=max(dp[i][j][0],dp[i-1][k][0]+qs[i-1][j]-qs[i-1][k]);
if(i>3) dp[i][j][0]=max(dp[i][j][0],dp[i-2][k][0]+qs[i-1][j]),
dp[i][j][0]=max(dp[i][j][0],dp[i-2][k][1]+qs[i-1][j]);
}
for(int k=j;k<=N;++k){
dp[i][j][1]=max(dp[i][j][1],dp[i-1][k][1]+qs[i][k]-qs[i][j]);
dp[i][j][1]=max(dp[i][j][1],dp[i-1][k][0]+qs[i][k]-qs[i][j]);
if(i>2) dp[i][j][1]=max(dp[i][j][1],dp[i-2][k][1]+qs[i-1][k]),
dp[i][j][1]=max(dp[i][j][1],dp[i-2][k][0]+qs[i-1][k]);
}
}
}
return dp[N+1][0][1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
311 ms |
17744 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Runtime error |
329 ms |
22868 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
316 ms |
12476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4596 KB |
Output is correct |
2 |
Correct |
1 ms |
4536 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4536 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4700 KB |
1st lines differ - on the 1st token, expected: '8866', found: '16621' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4596 KB |
Output is correct |
2 |
Correct |
1 ms |
4536 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4536 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4700 KB |
1st lines differ - on the 1st token, expected: '8866', found: '16621' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4596 KB |
Output is correct |
2 |
Correct |
1 ms |
4536 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4536 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4700 KB |
1st lines differ - on the 1st token, expected: '8866', found: '16621' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
316 ms |
12476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
311 ms |
17744 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |