실행 실패 (제출 코드 컴파일 에러)
{"stderr": "Main.cpp: In function \u2018int main()\u2019:\nMain.cpp:23:29: error: conflicting declaration \u2018std::unordered_map<int, int> countA\u2019\n 23 | unordered_map<int, int> countA;\n | ^~~~~~\nMain.cpp:20:50: note: previous declaration as \u2018std::unordered_map<std::pair<int, int>, int, PairHash> countA\u2019\n 20 | unordered_map<pair<int, int>, int, PairHash> countA;\n | ^~~~~~\nMain.cpp:24:9: error: redeclaration of \u2018int bal\u2019\n 24 | int bal = 0;\n | ^~~\nMain.cpp:22:9: note: \u2018int bal\u2019 previously declared here\n 22 | int bal = 0, min_bal = 0;\n | ^~~\nMain.cpp:28:15: error: no match for \u2018operator[]\u2019 (operand types are \u2018std::unordered_map<std::pair<int, int>, int, PairHash>\u2019 and \u2018int\u2019)\n 28 | countA[bal]++;\n | ^\nIn file included from /usr/include/c++/11/unordered_map:47,\n from Main.cpp:3:\n/usr/include/c++/11/bits/unordered_map.h:979:7: note: candidate: \u2018std::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>]\u2019\n 979 | operator[](const key_type& __k)\n | ^~~~~~~~\n/usr/include/c++/11/bits/unordered_map.h:979:34: note: no known conversion for argument 1 from \u2018int\u2019 to \u2018const key_type&\u2019 {aka \u2018const std::pair<int, int>&\u2019}\n 979 | operator[](const key_type& __k)\n | ~~~~~~~~~~~~~~~~^~~\n/usr/include/c++/11/bits/unordered_map.h:983:7: note: candidate: \u2018std::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>]\u2019\n 983 | operator[](key_type&& __k)\n | ^~~~~~~~\n/usr/include/c++/11/bits/unordered_map.h:983:29: note: no known conversion for argument 1 from \u2018int\u2019 to \u2018std::unordered_map<std::pair<int, int>, int, PairHash>::key_type&&\u2019 {aka \u2018std::pair<int, int>&&\u2019}\n 983 | operator[](key_type&& __k)\n | ~~~~~~~~~~~^~~\nMain.cpp:41:21: error: no matching function for call to \u2018std::unordered_map<std::pair<int, int>, int, PairHash>::count(int&)\u2019\n 41 | if (countA.count(target) && min_bal + target >= 0) {\n | ~~~~~~~~~~~~^~~~~~~~\nIn file included from /usr/include/c++/11/unordered_map:47,\n from Main.cpp:3:\n/usr/include/c++/11/bits/unordered_map.h:907:9: note: candidate: \u2018template<class _Kt> decltype (((const std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>*)this)->std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::_M_h._M_count_tr(__x)) std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::count(const _Kt&) const [with _Kt = _Kt; _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> >]\u2019\n 907 | count(const _Kt& __x) const -> decltype(_M_h._M_count_tr(__x))\n | ^~~~~\n/usr/include/c++/11/bits/unordered_map.h:907:9: note: template argument deduction/subs(...truncated, total 11735 characters, 1 lines)
정답 개수:
-
틀린 개수:
-
실행 실패 개수:
-
반례를 발견하지 못했습니다.