# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
974450 | saayan007 | 경주 (Race) (IOI11_race) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "race.h"
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define repd(i, a, b) for(int i = (a); i >= (b); --i)
#define em emplace
#define eb emplace_back
#define pi pair<int, int>
#define fr first
#define sc second
#define mp make_pair
const char nl = '\n';
const int M = 1010;
vector<pi> adj[M];
int dfs(int x, int p, int dist, int high, int K) {
if(dist == K) return high;
else if(dist > K) return m;
int ans = m;
for(auto [y, w] : adj[x]) {
if(y == p) continue;
ans = min(ans, dfs(y, x, dist + w, high + 1, K));
}
return ans;
}
int best_path(int N, int K, int H[][2], int L[])
{
rep(i, 0, N - 2) {
++H[i][0]; ++H[i][1];
adj[H[i][0]].eb(H[i][1]);
adj[H[i][1]].eb(H[i][0]);
}
int ans = N;
rep(i, 1, N) {
/* ans = min(ans, dfs(i, 0, 0, 0, K)); */
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
race.cpp: In function 'int dfs(int, int, int, int, int)': race.cpp:22:30: error: 'm' was not declared in this scope 22 | else if(dist > K) return m; | ^ race.cpp:24:15: error: 'm' was not declared in this scope 24 | int ans = m; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33, from /usr/include/c++/10/bits/allocator.h:46, from /usr/include/c++/10/string:41, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from race.cpp:2: /usr/include/c++/10/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<int, int>; _Args = {int&}; _Tp = std::pair<int, int>]': /usr/include/c++/10/bits/alloc_traits.h:512:17: required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::pair<int, int>; _Args = {int&}; _Tp = std::pair<int, int>; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<std::pair<int, int> >]' /usr/include/c++/10/bits/vector.tcc:115:30: required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int&}; _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::reference = std::pair<int, int>&]' race.cpp:36:32: required from here /usr/include/c++/10/ext/new_allocator.h:150:4: error: no matching function for call to 'std::pair<int, int>::pair(int&)' 150 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from race.cpp:2: /usr/include/c++/10/bits/stl_pair.h:452:9: note: candidate: 'template<class ... _Args1, long unsigned int ..._Indexes1, class ... _Args2, long unsigned int ..._Indexes2> std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>, std::_Index_tuple<_Indexes2 ...>) [with _Args1 = {_Args1 ...}; long unsigned int ..._Indexes1 = {_Indexes1 ...}; _Args2 = {_Args2 ...}; long unsigned int ..._Indexes2 = {_Indexes2 ...}; _T1 = int; _T2 = int]' 452 | pair(tuple<_Args1...>&, tuple<_Args2...>&, | ^~~~ /usr/include/c++/10/bits/stl_pair.h:452:9: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33, from /usr/include/c++/10/bits/allocator.h:46, from /usr/include/c++/10/string:41, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from race.cpp:2: /usr/include/c++/10/ext/new_allocator.h:150:4: note: mismatched types 'std::tuple<_Tps ...>' and 'int' 150 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from race.cpp:2: /usr/include/c++/10/bits/stl_pair.h:387:9: note: candidate: 'template<class ... _Args1, class ... _Args2> std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::tuple<_Args1 ...>, std::tuple<_Args2 ...>) [with _Args1 = {_Args1 ...}; _Args2 = {_Args2 ...}; _T1 = int; _T2 = int]' 387 | pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); | ^~~~ /usr/include/c++/10/bits/stl_pair.h:387:9: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33, from /usr/include/c++/10/bits/allocator.h:46, from /usr/include/c++/10/string:41, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from race.cpp:2: /usr/include/c++/10/ext/new_allocator.h:150:4: note: candidate expects 3 arguments, 1 provided 150 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from race.cpp:2: /usr/include/c++/10/bits/stl_pair.h:381:21: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 381 | explicit constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:381:21: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33, from /usr/include/c++/10/bits/allocator.h:46, from /usr/include/c++/10/string:41, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from race.cpp:2: /usr/include/c++/10/ext/new_allocator.h:150:4: note: mismatched types 'std::pair<_T1, _T2>' and 'int' 150 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from race.cpp:2: /usr/include/c++/10/bits/stl_pair.h:371:12: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 371 | constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:371:12: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33, from /usr/include/c++/10/bits/allocator.h:46, from /usr/include/c++/10/string:41, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from race.cpp:2: /usr/include/c++/10/ext/new_allocator.h:150:4: note: mismatched types 'std::pair<_T1, _T2>' and 'int' 150 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from race.cpp:2: /usr/include/c++/10/bits/stl_pair.h:361:21: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 361 | explicit constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:361:21: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33, from /usr/include/c++/10/bits/allocator.h:46, from /usr/include/c++/10/string:41, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from race.cpp:2: /usr/include/c++/10/ext/new_allocator.h:150:4: note: candidate expects 2 arguments, 1 provided 150 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from race.cpp:2: /usr/include/c++/10/bits/stl_pair.h:352:12: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 352 | constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:352:12: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33, from /usr/include/c++/10/bits/allocator.h:46, from /usr/include/c++/10/string:41, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from race.cpp:2: /usr/include/c++/10/ext/new_allocator.h:150:4: note: candidate expects 2 arguments, 1 provided 150 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from race.cpp:2: /usr/include/c++/10/bits/stl_pair.h:343:17: note: candidate: 'template<class _U2, typename std::enable_if<_CopyMovePair<false, int, _U2>(), bool>::type <anonymous> > std::pair<_T1, _T2>::pair(const _T1&, _U2&&) [with _U2 = _U2; typename std::enable_if<std::_PCC<true, _T1, _T2>::_CopyMovePair<false, _T1, _U2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 343 | explicit pair(const _T1& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:343:17: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33, from /usr/include/c++/10/bits/allocator.h:46, from /usr/include/c++/10/string:41, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from race.cpp:2: /usr/include/c++/10/ext/new_allocator.h:150:4: note: candidate expects 2 arguments, 1 provided 150 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from race.cpp:2: /usr/include/c++/10/bits/stl_pair.h:336:18: note: candidate: 'template<class _U2, typename std::enable_if<_CopyMovePair<true, int, _U2>(), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const _T1&, _U2&&) [with _U2 = _U2; typename std::enable_if<std::_PCC<true, _T1, _T2>::_CopyMovePair<true, _T1, _U2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 336 | constexpr pair(const _T1& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:336:18: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33, from /usr/include/c++/10/bits/allocator.h:46, from /usr/include/c++/10/string:41, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from race.cpp:2: /usr/include/c++/10/ext/new_allocator.h:150:4: note: candidate expects 2 arguments, 1 provided 150 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from race.cpp:2: /usr/include/c++/10/bits/stl_pair.h:329:27: note: candidate: 'template<class _U1, typename std::enable_if<_MoveCopyPair<false, _U1, int>(), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, const _T2&) [with _U1 = _U1; typename std::enable_if<std::_PCC<true, _T1, _T2>::_MoveCopyPair<false, _U1, _T2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 329 | explicit constexpr pair(_U1&& __x, const _T2& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:329:27: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33, from /usr/include/c++/10/bits/allocator.h:46, from /usr/include/c++/10/string:41, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c