실행 실패 (제출 코드 컴파일 에러)
Main.cpp: In function ‘int main()’: Main.cpp:23:29: error: conflicting declaration ‘std::unordered_map<int, int> countA’ 23 | unordered_map<int, int> countA; | ^~~~~~ Main.cpp:20:50: note: previous declaration as ‘std::unordered_map<std::pair<int, int>, int, PairHash> countA’ 20 | unordered_map<pair<int, int>, int, PairHash> countA; | ^~~~~~ Main.cpp:24:9: error: redeclaration of ‘int bal’ 24 | int bal = 0; | ^~~ Main.cpp:22:9: note: ‘int bal’ previously declared here 22 | int bal = 0, min_bal = 0; | ^~~ Main.cpp:28:15: error: no match for ‘operator[]’ (operand types are ‘std::unordered_map<std::pair<int, int>, int, PairHash>’ and ‘int’) 28 | countA[bal]++; | ^ In file included from /usr/include/c++/11/unordered_map:47, from Main.cpp:3: /usr/include/c++/11/bits/unordered_map.h:979:7: note: candidate: ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type&) [with _Key = std::pair<int, int>; _Tp = int; _Hash = PairHash; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = std::pair<int, int>]’ 979 | operator[](const key_type& __k) | ^~~~~~~~ /usr/include/c++/11/bits/unordered_map.h:979:34: note: no known conversion for argument 1 from ‘int’ to ‘const key_type&’ {aka ‘const std::pair<int, int>&’} 979 | operator[](const key_type& __k) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/11/bits/unordered_map.h:983:7: note: candidate: ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type&&) [with _Key = std::pair<int, int>; _Tp = int; _Hash = PairHash; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = std::pair<int, int>]’ 983 | operator[](key_type&& __k) | ^~~~~~~~ /usr/include/c++/11/bits/unordered_map.h:983:29: note: no known conversion for argument 1 from ‘int’ to ‘std::unordered_map<std::pair<int, int>, int, PairHash>::key_type&&’ {aka ‘std::pair<int, int>&&’} 983 | operator[](key_type&& __k) | ~~~~~~~~~~~^~~ Main.cpp:40:28: error: cannot convert ‘const std::pair<int, int>’ to ‘int’ in initialization 40 | int a_bal = it.first; | ~~~^~~~~ | | | const std::pair<int, int>
정답 개수:
-
틀린 개수:
-
실행 실패 개수:
-
반례를 발견하지 못했습니다.