Submission #778520

#TimeUsernameProblemLanguageResultExecution timeMemory
778520Mouad_oujCatfish Farm (IOI22_fish)C++17
Compilation error
0 ms0 KiB
#include "fish.h"//sub3 #include <bits/stdc++.h> using namespace std; long long max_weights(int n, int m,vector<int> b,vector<int> y,vector<int> w) { long long tab[n]={0},dp[n][4]={0}; for(int a=0;a<m;a++) tab[b[a]]=w[a]; dp[0][0]=tab[0];dp[0][1]=tab[0]; dp[0][2]=tab[0];dp[0][3]=tab[0]; for(int a=2;a<n;a++) { dp[x][0]=max(dp[x-1][0],dp[x-1][1]+tab[x-1]); dp[x][1]=max(dp[x-1][3]+tab[x],dp[x-1][2]+tab[x]); dp[x][2]=max(dp[x-1][1],dp[x-1][0]+tab[x-1]); dp[x][3]=max(dp[x-1][3],dp[x-1][2]); } long long ans=max(max(dp[n-1][0],dp[n-1][1]),max(dp[n-1][2],dp[n-1][3])); return ans; }

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:13:8: error: 'x' was not declared in this scope
   13 |     dp[x][0]=max(dp[x-1][0],dp[x-1][1]+tab[x-1]);
      |        ^