Problem contestcalc
User gordonlu
Submission Time 2023-11-05 18:28:04
Score 0
Max Time N/A
Max Memory N/A

Compile Error

contestcalc.cpp: In function ‘int main()’:
contestcalc.cpp:24:34: error: no match for ‘operator[]’ (operand types are ‘std::vector<std::pair<std::__cxx11::basic_string<char>, int> >’ and ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’})
24 | selectedContestants[i] = scores[selectedContestant]->second;
| ^
In file included from /usr/include/c++/9/vector:67,
from contestcalc.cpp:2:
/usr/include/c++/9/bits/stl_vector.h:1040:7: note: candidate: ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::pair<std::__cxx11::basic_string<char>, int>; _Alloc = std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >; std::vector<_Tp, _Alloc>::reference = std::pair<std::__cxx11::basic_string<char>, int>&; std::vector<_Tp, _Alloc>::size_ty