# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
302270 | kevlee | Simurgh (IOI17_simurgh) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "simurgh.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a))
#define all(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
vi ans;
int m;
vp edges[505];
int group[505];
int f(int x) {
return x == group[x] ? x : group[x] = f(group[x]);
}
vi find_roads(int n, vi u, vi v) {
m = u.size();
FOR(i, 0, m-1) {
edges[u[i]].emplace_back(v, i);
edges[v[i]].emplace_back(u, i);
}
FOR(i, 0, n-1) {
int sz = edges[i].size();
if (sz == 1) {
ans.pb(edges[i][0].se);
continue;
}
FOR(i, 0, n-1) group[i] = i;
vi query;
FOR(j, 0, m-1) {
if (u[j] == i || v[j] == i) continue;
int x = f(u[j]);
int y = f(v[j]);
if (x != y) {
query.pb(j);
group[x] = y;
}
}
query.pb(edges[i][0].se);
int cnt = count_common_roads(query);
query.pop_back();
FOR(j, 1, sz-1) {
query.pb(edges[i][j].se);
int cnt2 = count_common_roads(query);
if (cnt2 > cnt) {
ans.pb(edges[i][j].se);
break;
}
if (cnt2 < cnt) {
ans.pb(edges[i][0].se);
break;
}
query.pop_back();
}
}
return ans;
}
Compilation message (stderr)
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33, from /usr/include/c++/9/bits/allocator.h:46, from /usr/include/c++/9/vector:64, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<int, int>; _Args = {std::vector<int, std::allocator<int> >&, int&}; _Tp = std::pair<int, int>]': /usr/include/c++/9/bits/alloc_traits.h:482:2: required from 'static void std::allocator_traits<std::allocator<_Tp1> >::construct(std::allocator_traits<std::allocator<_Tp1> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::pair<int, int>; _Args = {std::vector<int, std::allocator<int> >&, int&}; _Tp = std::pair<int, int>; std::allocator_traits<std::allocator<_Tp1> >::allocator_type = std::allocator<std::pair<int, int> >]' /usr/include/c++/9/bits/vector.tcc:115:30: required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::vector<int, std::allocator<int> >&, int&}; _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::reference = std::pair<int, int>&]' simurgh.cpp:35:34: required from here /usr/include/c++/9/ext/new_allocator.h:145:20: error: no matching function for call to 'std::pair<int, int>::pair(std::vector<int>&, int&)' 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/vector:60, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/bits/stl_pair.h:436: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 ...>)' 436 | pair(tuple<_Args1...>&, tuple<_Args2...>&, | ^~~~ /usr/include/c++/9/bits/stl_pair.h:436:9: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33, from /usr/include/c++/9/bits/allocator.h:46, from /usr/include/c++/9/vector:64, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/ext/new_allocator.h:145:20: note: 'std::vector<int>' is not derived from 'std::tuple<_Tps ...>' 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/vector:60, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/bits/stl_pair.h:375:9: note: candidate: 'template<class ... _Args1, class ... _Args2> std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::tuple<_Args1 ...>, std::tuple<_Args2 ...>)' 375 | pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); | ^~~~ /usr/include/c++/9/bits/stl_pair.h:375:9: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33, from /usr/include/c++/9/bits/allocator.h:46, from /usr/include/c++/9/vector:64, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/ext/new_allocator.h:145:20: note: mismatched types 'std::tuple<_Tps ...>' and 'int' 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/vector:60, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/bits/stl_pair.h:370: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>&&)' 370 | explicit constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:370:21: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33, from /usr/include/c++/9/bits/allocator.h:46, from /usr/include/c++/9/vector:64, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/ext/new_allocator.h:145:20: note: 'std::vector<int>' is not derived from 'std::pair<_T1, _T2>' 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/vector:60, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/bits/stl_pair.h:360: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>&&)' 360 | constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:360:12: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33, from /usr/include/c++/9/bits/allocator.h:46, from /usr/include/c++/9/vector:64, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/ext/new_allocator.h:145:20: note: 'std::vector<int>' is not derived from 'std::pair<_T1, _T2>' 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/vector:60, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/bits/stl_pair.h:350: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&&)' 350 | explicit constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:350:21: note: template argument deduction/substitution failed: /usr/include/c++/9/bits/stl_pair.h:349:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 349 | bool>::type=false> | ^~~~~ /usr/include/c++/9/bits/stl_pair.h:341: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&&)' 341 | constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:341:12: note: template argument deduction/substitution failed: /usr/include/c++/9/bits/stl_pair.h:340:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 340 | bool>::type=true> | ^~~~ /usr/include/c++/9/bits/stl_pair.h:332: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&&)' 332 | explicit pair(const _T1& __x, _U2&& __y) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:332:17: note: template argument deduction/substitution failed: /usr/include/c++/9/bits/stl_pair.h:331:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 331 | bool>::type=false> | ^~~~~ /usr/include/c++/9/bits/stl_pair.h:325: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&&)' 325 | constexpr pair(const _T1& __x, _U2&& __y) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:325:18: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33, from /usr/include/c++/9/bits/allocator.h:46, from /usr/include/c++/9/vector:64, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/ext/new_allocator.h:145:20: note: cannot convert 'std::forward<std::vector<int>&>((* & __args#0))' (type 'std::vector<int>') to type 'const int&' 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/vector:60, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/bits/stl_pair.h:318: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&)' 318 | explicit constexpr pair(_U1&& __x, const _T2& __y) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:318:27: note: template argument deduction/substitution failed: /usr/include/c++/9/bits/stl_pair.h:317:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 317 | bool>::type=false> | ^~~~~ /usr/include/c++/9/bits/stl_pair.h:311:18: note: candidate: 'template<class _U1, typename std::enable_if<_MoveCopyPair<true, _U1, int>(), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, const _T2&)' 311 | constexpr pair(_U1&& __x, const _T2& __y) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:311:18: note: template argument deduction/substitution failed: /usr/include/c++/9/bits/stl_pair.h:310:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 310 | bool>::type=true> | ^~~~ /usr/include/c++/9/bits/stl_pair.h:304:17: note: candidate: 'constexpr std::pair<_T1, _T2>::pair(std::pair<_T1, _T2>&&) [with _T1 = int; _T2 = int]' 304 | constexpr pair(pair&&) = default; | ^~~~ /usr/include/c++/9/bits/stl_pair.h:304:17: note: candidate expects 1 argument, 2 provided /usr/include/c++/9/bits/stl_pair.h:303:17: note: candidate: 'constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = int; _T2 = int]' 303 | constexpr pair(const pair&) = default; | ^~~~ /usr/include/c++/9/bits/stl_pair.h:303:17: note: candidate expects 1 argument, 2 provided /usr/include/c++/9/bits/stl_pair.h:300: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>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&)' 300 | explicit constexpr pair(const pair<_U1, _U2>& __p) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:300:21: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33, from /usr/include/c++/9/bits/allocator.h:46, from /usr/include/c++/9/vector:64, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/ext/new_allocator.h:145:20: note: 'std::vector<int>' is not derived from 'const std::pair<_T1, _T2>' 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/vector:60, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/bits/stl_pair.h:291:19: 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>::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&)' 291 | constexpr pair(const pair<_U1, _U2>& __p) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:291:19: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33, from /usr/include/c++/9/bits/allocator.h:46, from /usr/include/c++/9/vector:64, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/ext/new_allocator.h:145:20: note: 'std::vector<int>' is not derived from 'const std::pair<_T1, _T2>' 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/vector:60, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/bits/stl_pair.h:269:26: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_ConstructiblePair<_U1, _U2>() && (! _ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&)' 269 | explicit constexpr pair(const _T1& __a, const _T2& __b) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:269:26: note: template argument deduction/substitution failed: /usr/include/c++/9/bits/stl_pair.h:268:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 268 | bool>::type=false> | ^~~~~ /usr/include/c++/9/bits/stl_pair.h:260:17: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_ConstructiblePair<_U1, _U2>() && _ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&)' 260 | constexpr pair(const _T1& __a, const _T2& __b) | ^~~~ /usr/include/c++/9/bits/stl_pair.h:260:17: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33, from /usr/include/c++/9/bits/allocator.h:46, from /usr/include/c++/9/vector:64, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/ext/new_allocator.h:145:20: note: cannot convert 'std::forward<std::vector<int>&>((* & __args#0))' (type 'std::vector<int>') to type 'const int&' 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/vector:60, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/bits/stl_pair.h:242:26: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<std::__and_<std::is_default_constructible<_Tp>, std::is_default_constructible<_U2>, std::__not_<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> > > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair()' 242 | explicit constexpr pair() | ^~~~ /usr/include/c++/9/bits/stl_pair.h:242:26: note: template argument deduction/substitution failed: In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33, from /usr/include/c++/9/bits/allocator.h:46, from /usr/include/c++/9/vector:64, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/ext/new_allocator.h:145:20: note: candidate expects 0 arguments, 2 provided 145 | noexcept(noexcept(::new((void *)__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/vector:60, from simurgh.h:1, from simurgh.cpp:1: /usr/include/c++/9/bits/stl_pair.h:229:26: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair()' 229 | _GLIBCXX_CONSTEXPR pair() |