Problem arrayfind
User Martin
Submission Time 2026-08-30 12:31:46
Score 0
Max Time N/A
Max Memory N/A

Compile Error

arrayfind.cpp: In function ‘int main()’:
arrayfind.cpp:14:9: error: ‘Q’ was not declared in this scope
14 | cin >> Q;
| ^
arrayfind.cpp:23:12: error: redeclaration of ‘auto i’
23 | greater[i] = N-p;
| ^
arrayfind.cpp:18:11: note: ‘int i’ previously declared here
18 | for (int i = 0; i < Q; i ++) {
| ^
arrayfind.cpp:23:17: error: invalid operands of types ‘int’ and ‘int*’ to binary ‘operator-’
23 | greater[i] = N-p;
| ~^~
| | |
| | int*
| int
arrayfind.cpp:24:3: error: ‘smaller’ was not declared in this scope
24 | smaller[i] = p-1;
| ^~~~~~~
arrayfind.cpp:28:26: error: ‘smaller’ was not declared in this scope
28 | cout << "Smaller: " << smaller[i] << ", Greater: " << greater[i] << endl;
| ^~~