Submission #777916

#TimeUsernameProblemLanguageResultExecution timeMemory
777916Mouad_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> x,vector<int> y,vector<int> w) { long long tab[n]={0},ans=0,dp[n]; for(int x=0;x<m;x++) tab[x]+=w[x[a]]; dp[0]=tab[0]; dp[1]=max(tab[0],tab[1]); for(int x=2;x<n;x++) dp[x]=max(dp[x-1],dp[x-2]+tab[x]); return dp[n-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:8:21: error: 'a' was not declared in this scope
    8 |         tab[x]+=w[x[a]];
      |                     ^
fish.cpp:6:26: warning: unused variable 'ans' [-Wunused-variable]
    6 |     long long tab[n]={0},ans=0,dp[n];
      |                          ^~~