#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
ll max_weights(int n,int m,vector<int>x,vector<int>y,vector<int>w){
int even=0,X=0,Y=0;
for(int i=0;i<m;i++){
X=max(X,x[i]);
Y=max(Y,y[i]);
if(x[i]%2==0) even++;
}
if(even==m){
ll ans=0;
for(int i=0;i<m;i++){
ans+=w[i];
}
return ans;
}
if(X[i]<=1){
ll ans=0,cur=0;
for(int i=0;i<m;i++){
if(x[i]==0){
ans+=w[i];
}
else{
cur+=w[i];
}
}
if(n==2) return max(ans,cur);
ll sum[n][2];
memset(sum,0,sizeof sum);
for(int i=0;i<m;i++){
sum[y[i]][x[i]]+=w[i];
}
ans=max(ans,cur);
for(int i=1;i<n;i++){
ans=max(ans,sum[i][0]+sum[n-1][1]-sum[i][1]);
}
return ans;
}
}
Compilation message
fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:26:10: error: 'i' was not declared in this scope
26 | if(X[i]<=1){
| ^
fish.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
48 | }
| ^