#include <bits/stdc++.h>
#define div /
#define ll long long
#define fore(i, l, r) for(int i=int(l); i<int(r); i++)
#define sz(a) int((a).size())
using namespace std;
const int INF = 1e9;
const int MX = 5e5 + 23;
const int MOD = 1000000007;
const int MAX_N = 5e5+23;
const int N = 1e6;
int64 max_weights(int N, int M, int[] X, int[] Y, int[] W) {
int ok=1,ok1=1;
fore(i,0,m) {
if(x[i] % 2)
ok=0;
if(x[i] > 1)
ok1=0;
}
int ans=0;
if(ok)
fore(i,0,m)
ans+=w[i];
else if(ok1) {
int sum1=0,sum2=0;
fore(i,0,m) {
if(x[i] == 0)
sum1+=w[i];
else
sum2+=w[i];
}
ans = max(sum1,sum2);
} else {
int dp[n+5];
memset(dp,0,sizeof dp);
int grid[n+5];
memset(grid,0,sizeof grid);
fore(i,0,m)
grid[x[i]] = w[i];
fore(i,0,n) {
dp[i] = grid[i];
if(i > 1)
dp[i] += dp[i-2];
if(i)
dp[i] = max(dp[i],dp[i-1]);
}
ans = dp[n-1];
}
return ans;
}
Compilation message
fish.cpp:16:1: error: 'int64' does not name a type; did you mean 'int64_t'?
16 | int64 max_weights(int N, int M, int[] X, int[] Y, int[] W) {
| ^~~~~
| int64_t