Problem snacks
User yoshiokalili
Submission Time 2026-02-20 20:05:56
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:18:23: error: ‘r’ was not declared in this scope
18 | if (s >= l && s <= r) {
| ^
snacks.cpp:20:13: error: ‘v’ was not declared in this scope
20 | a.erase(v.begin() + distance(a, it)); //erase index of valid snack
| ^
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(v.begin() + distance(a, it)); //erase index of valid snack
| ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:66,
from /usr