Submission #788511

#TimeUsernameProblemLanguageResultExecution timeMemory
788511alexander707070Distributing Candies (IOI21_candies)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define MAXN 1000007 using namespace std; int n; vector<int> curr; vector<int> distribute_candies(vector<int> c,vector<int> l,vector<int> r,vector<int> v){ n=int(c.size()); curr.resize(n); for(int i=0;i<q;i++){ for(int f=l[i];f<=r[i];f++){ curr[f]+=v[i]; if(curr[f]<0)curr[f]=0 if(curr[f]>c[f])curr[f]=c[f]; } } return curr; }

Compilation message (stderr)

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:12:19: error: 'q' was not declared in this scope
   12 |     for(int i=0;i<q;i++){
      |                   ^
candies.cpp:15:35: error: expected ';' before 'if'
   15 |             if(curr[f]<0)curr[f]=0
      |                                   ^
      |                                   ;
   16 |             if(curr[f]>c[f])curr[f]=c[f];
      |             ~~