Submission #761509

#TimeUsernameProblemLanguageResultExecution timeMemory
761509raul2008487Catfish Farm (IOI22_fish)C++17
Compilation error
0 ms0 KiB
#include "fish.h" #include<bits/stdc++.h> #define pb push_back #define ll long long #define pll pair<ll,ll> using namespace std; long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { vector<ll> fish(N,0); vector<vector<ll>> dp(N,vector<ll>(2)); ll i; for(i=0;i<M;i++){ fish[X[i]]=W[i]; } dp[0][0]=dp[0][1]=0; dp[1][0]=fish[1];dp[1][1]=fish[0]; for(i=2;i<N;i++){ dp[i][0]=max(dp[i-1][1]+fish[i],dp[i-1][0]); dp[i][1]=max(dp[i-2][0],dp[i-2][1])+fish[i-1]; } return max(dp[n-1][0],dp[n-1][1]); }

Compilation message (stderr)

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:20:19: error: 'n' was not declared in this scope
   20 |     return max(dp[n-1][0],dp[n-1][1]);
      |                   ^