Problem mirrors
User cwu
Submission Time 2026-06-14 20:10:56
Score 0
Max Time N/A
Max Memory N/A

Compile Error

mirrors.cpp: In function ‘int main()’:
mirrors.cpp:19:20: error: no match for ‘operator=’ (operand types are ‘std::map<long long int, int>’ and ‘int’)
19 | sum_to_index = 0; // Base case: sum of 0 elements is at index 0
| ^
In file included from /usr/include/c++/9/map:61,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:81,
from mirrors.cpp:1:
/usr/include/c++/9/bits/stl_map.h:317:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>& std::map<_Key, _Tp, _Compare, _Alloc>::operator=(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = long long int; _Tp = int; _Compare = std::less<long long int>; _Alloc = std::allocator<std::pair<const long long int, int> >]’
317 | operator=(const map&) = default;
| ^~~~~~~~
/usr/include/c++/9/bits/stl_map.h:317:17: note: no known conversion for argument 1 from ‘int’ to ‘const s