# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
777916 | Mouad_ouj | Catfish Farm (IOI22_fish) | C++17 | 0 ms | 0 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 "fish.h"//sub3
#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 tab[n]={0},ans=0,dp[n];
for(int x=0;x<m;x++)
tab[x]+=w[x[a]];
dp[0]=tab[0];
dp[1]=max(tab[0],tab[1]);
for(int x=2;x<n;x++)
dp[x]=max(dp[x-1],dp[x-2]+tab[x]);
return dp[n-1];
}