# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
858736 | imarn | Catfish Farm (IOI22_fish) | C++17 | 372 ms | 286308 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
//#include "insects.h"
#define f first
#define s second
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
//#define sz(x) (ll)x.size()
#define all(x) x.begin(),x.end()
using namespace std;
ll dp[3001][3001]{0};
ll mp[3001][3001]{0};
ll max_weights(int N, int M,vector<int> X,vector<int> Y,vector<int> W) {
for(int i=0;i<M;i++){
mp[Y[i]+1][X[i]+1]+=W[i];
}ll ans=0;
for(int i=1;i<=N;i++)for(int j=1;j<=N;j++)mp[i][j]+=mp[i-1][j];
for(int i=1;i<=N;i++){
for(int j=0;j<=N;j++){
dp[j][i]=0;
for(int k=0;k<=j;k++){
dp[j][i] = max(dp[k][i-1]+mp[j][i-1]-mp[k][i-1],dp[j][i]);
}
for(int k=j+1;k<=N;k++){
dp[j][i]=max(dp[k][i-1]+mp[k][i]-mp[j][i],dp[j][i]);
}
ans=max(ans,dp[j][i]);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |