# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1007349 | 2024-06-24T16:37:22 Z | Ludissey | 컴퓨터 네트워크 (BOI14_network) | C++14 | 컴파일 오류 |
0 ms | 0 KB |
#include "network.h" #include <bits/stdc++.h> #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() using namespace std; void findRoute (int N, int a, int b) { int d=ping(a,b); map<int,vector<int>> prox(d); for (int i = 1; i <= N; i++) { if(i!=a&&i!=b) { prox[ping(i,b)].push_back(i); } } int x=a; for (int i = d-1; i >= 0; i--){ for (auto u : prox[i]) { if(ping(x,u)==0) { x=u; travelTo(x); break;} } } travelTo(b); }
Compilation message
network.cpp: In function 'void findRoute(int, int, int)': network.cpp:11:32: error: no matching function for call to 'std::map<int, std::vector<int> >::map(int&)' 11 | map<int,vector<int>> prox(d); | ^ In file included from /usr/include/c++/10/map:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from network.cpp:2: /usr/include/c++/10/bits/stl_map.h:290:2: note: candidate: 'template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator, const _Compare&, const allocator_type&) [with _InputIterator = _InputIterator; _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >]' 290 | map(_InputIterator __first, _InputIterator __last, | ^~~ /usr/include/c++/10/bits/stl_map.h:290:2: note: template argument deduction/substitution failed: network.cpp:11:32: note: candidate expects 4 arguments, 1 provided 11 | map<int,vector<int>> prox(d); | ^ In file included from /usr/include/c++/10/map:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from network.cpp:2: /usr/include/c++/10/bits/stl_map.h:273:2: note: candidate: 'template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >]' 273 | map(_InputIterator __first, _InputIterator __last) | ^~~ /usr/include/c++/10/bits/stl_map.h:273:2: note: template argument deduction/substitution failed: network.cpp:11:32: note: candidate expects 2 arguments, 1 provided 11 | map<int,vector<int>> prox(d); | ^ In file included from /usr/include/c++/10/map:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from network.cpp:2: /usr/include/c++/10/bits/stl_map.h:256:2: note: candidate: 'template<class _InputIterator> std::map<_Key, _Tp, _Compare, _Alloc>::map(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = _InputIterator; _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >]' 256 | map(_InputIterator __first, _InputIterator __last, | ^~~ /usr/include/c++/10/bits/stl_map.h:256:2: note: template argument deduction/substitution failed: network.cpp:11:32: note: candidate expects 3 arguments, 1 provided 11 | map<int,vector<int>> prox(d); | ^ In file included from /usr/include/c++/10/map:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from network.cpp:2: /usr/include/c++/10/bits/stl_map.h:250:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::initializer_list<std::pair<const _Key, _Tp> >, const allocator_type&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const int, std::vector<int> > >]' 250 | map(initializer_list<value_type> __l, const allocator_type& __a) | ^~~ /usr/include/c++/10/bits/stl_map.h:250:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/stl_map.h:244:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::map<_Key, _Tp, _Compare, _Alloc>&&, const allocator_type&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const int, std::vector<int> > >]' 244 | map(map&& __m, const allocator_type& __a) | ^~~ /usr/include/c++/10/bits/stl_map.h:244:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/stl_map.h:240:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&, const allocator_type&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const int, std::vector<int> > >]' 240 | map(const map& __m, const allocator_type& __a) | ^~~ /usr/include/c++/10/bits/stl_map.h:240:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/stl_map.h:236:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const allocator_type&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const int, std::vector<int> > >]' 236 | map(const allocator_type& __a) | ^~~ /usr/include/c++/10/bits/stl_map.h:236:33: note: no known conversion for argument 1 from 'int' to 'const allocator_type&' {aka 'const std::allocator<std::pair<const int, std::vector<int> > >&'} 236 | map(const allocator_type& __a) | ~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_map.h:228:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::initializer_list<std::pair<const _Key, _Tp> >, const _Compare&, const allocator_type&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const int, std::vector<int> > >]' 228 | map(initializer_list<value_type> __l, | ^~~ /usr/include/c++/10/bits/stl_map.h:228:40: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::pair<const int, std::vector<int> > >' 228 | map(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_map.h:215:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(std::map<_Key, _Tp, _Compare, _Alloc>&&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >]' 215 | map(map&&) = default; | ^~~ /usr/include/c++/10/bits/stl_map.h:215:11: note: no known conversion for argument 1 from 'int' to 'std::map<int, std::vector<int> >&&' 215 | map(map&&) = default; | ^~~~~ /usr/include/c++/10/bits/stl_map.h:207:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >]' 207 | map(const map&) = default; | ^~~ /usr/include/c++/10/bits/stl_map.h:207:11: note: no known conversion for argument 1 from 'int' to 'const std::map<int, std::vector<int> >&' 207 | map(const map&) = default; | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_map.h:194:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map(const _Compare&, const allocator_type&) [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::allocator_type = std::allocator<std::pair<const int, std::vector<int> > >]' 194 | map(const _Compare& __comp, | ^~~ /usr/include/c++/10/bits/stl_map.h:194:27: note: no known conversion for argument 1 from 'int' to 'const std::less<int>&' 194 | map(const _Compare& __comp, | ~~~~~~~~~~~~~~~~^~~~~~ /usr/include/c++/10/bits/stl_map.h:185:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::map() [with _Key = int; _Tp = std::vector<int>; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::vector<int> > >]' 185 | map() = default; | ^~~ /usr/include/c++/10/bits/stl_map.h:185:7: note: candidate expects 0 arguments, 1 provided grader.c: In function 'int main()': grader.c:48:11: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result] 48 | scanf ("%d%d%d%d", &N, &a, &b, &M); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ grader.c:51:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result] 51 | scanf("%d", &distance[u][v]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~