Problem snacks
User yoshiokalili
Submission Time 2026-02-20 20:06:40
Score 0
Max Time N/A
Max Memory N/A

Compile Error

snacks.cpp: In function ‘int main()’:
snacks.cpp:14:9: error: redeclaration of ‘int q’
14 | int l, q, x;
| ^
snacks.cpp:7:12: note: ‘int q’ previously declared here
7 | int n, q; cin >> n >> q; //n: no. of snacks
| ^
snacks.cpp:20:40: error: no matching function for call to ‘distance(std::vector<int>&, __gnu_cxx::__normal_iterator<int*, std::vector<int> >&)’
20 | a.erase(a.begin() + distance(a, it)); //erase index of valid snack
| ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:66,
from /usr/include/c++/9/bits/specfun.h:45,
from /usr/include/c++/9/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
from snacks.cpp:1:
/usr/include/c++/9/bits/stl_iterator_base_funcs.h:138:5: note: candidate: ‘template<class _InputIte