# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
777909 | 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"//sub2
#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 tab1[n]={0},tab2[n]={0};
for(int a=0;a<m;a++)
{
if(x[a]==0)
tab1[y[a]]+=w[a];
else
tab2[y[a]]+=w[a];
}
for(int x=1;x<n;x++)
{
tab1[a]+=tab1[a-1];
tab2[a]+=tab2[a-1];
}
long long ans=max(tab1[n-1],tab2[n-1]);
for(int a=0;a<n;a++)
{
ans=max(ans,tab1[a]+tab2[n-1]-tab2[a]);
}
return ans;
}