Submission #777909

#TimeUsernameProblemLanguageResultExecution timeMemory
777909Mouad_oujCatfish Farm (IOI22_fish)C++17
Compilation error
0 ms0 KiB
#include "fish.h"//sub2 #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 tab1[n]={0},tab2[n]={0}; for(int a=0;a<m;a++) { if(x[a]==0) tab1[y[a]]+=w[a]; else tab2[y[a]]+=w[a]; } for(int x=1;x<n;x++) { tab1[a]+=tab1[a-1]; tab2[a]+=tab2[a-1]; } long long ans=max(tab1[n-1],tab2[n-1]); for(int a=0;a<n;a++) { ans=max(ans,tab1[a]+tab2[n-1]-tab2[a]); } 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:16:14: error: 'a' was not declared in this scope
   16 |         tab1[a]+=tab1[a-1];
      |              ^