| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 499285 | blue | City Mapping (NOI18_citymapping) | 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 "citymapping.h"
#include <vector>
#include <iostream>
using namespace std;
using ll = long long;
using vi = vector<int>;
void find_roads(int N, int Q, int A[], int B[], int W[])
{
vector< tuple<ll, int, int> > E;
for(int i = 1; i <= N; i++)
for(int j = i+1; j <= N; j++)
E.push_back({get_distance(i, j), i, j});
sort(E.begin(), E.end());
int ct = -1;
vi cc(N+1);
for(int i = 1; i <= N; i++) cc[i] = i;
// for(auto e: E) cerr << get<1>(e) << ' ' << get<2>(e) << ' ' << get<0>(e) << '\n';
for(auto e: E)
{
ll w = get<0>(e);
int u = get<1>(e);
int v = get<2>(e);
if(cc[u] == cc[v]) continue;
int ccu = cc[u];
for(int i = 1; i <= N; i++)
if(cc[i] == ccu)
cc[i] = cc[v];
ct++;
A[ct] = u;
B[ct] = v;
W[ct] = w;
}
}
Compilation message (stderr)
citymapping.cpp: In function 'void find_roads(int, int, int*, int*, int*)':
citymapping.cpp:14:51: error: no matching function for call to 'std::vector<std::tuple<long long int, int, int> >::push_back(<brace-enclosed initializer list>)'
14 | E.push_back({get_distance(i, j), i, j});
| ^
In file included from /usr/include/c++/10/vector:67,
from citymapping.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::tuple<long long int, int, int>; _Alloc = std::allocator<std::tuple<long long int, int, int> >; std::vector<_Tp, _Alloc>::value_type = std::tuple<long long int, int, int>]'
1187 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::tuple<long long int, int, int>&'}
1187 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::tuple<long long int, int, int>; _Alloc = std::allocator<std::tuple<long long int, int, int> >; std::vector<_Tp, _Alloc>::value_type = std::tuple<long long int, int, int>]'
1203 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::tuple<long long int, int, int> >::value_type&&' {aka 'std::tuple<long long int, int, int>&&'}
1203 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
citymapping.cpp:16:5: error: 'sort' was not declared in this scope; did you mean 'qsort'?
16 | sort(E.begin(), E.end());
| ^~~~
| qsort
citymapping.cpp:25:14: error: 'std::tuple<long long int, int, int> e' has incomplete type
25 | for(auto e: E)
| ^
citymapping.cpp:27:16: error: 'get' was not declared in this scope; did you mean 'getw'?
27 | ll w = get<0>(e);
| ^~~
| getw
In file included from /usr/include/c++/10/vector:67,
from citymapping.cpp:2:
/usr/include/c++/10/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::tuple<long long int, int, int>; _Alloc = std::allocator<std::tuple<long long int, int, int> >]':
/usr/include/c++/10/bits/stl_vector.h:487:7: required from here
/usr/include/c++/10/bits/stl_vector.h:336:35: error: invalid use of incomplete type 'class std::tuple<long long int, int, int>'
336 | _M_impl._M_end_of_storage - _M_impl._M_start);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/vector:60,
from citymapping.cpp:2:
/usr/include/c++/10/type_traits:2631:11: note: declaration of 'class std::tuple<long long int, int, int>'
2631 | class tuple;
| ^~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
from /usr/include/c++/10/vector:60,
from citymapping.cpp:2:
/usr/include/c++/10/bits/stl_iterator.h: In instantiation of '__gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = std::tuple<long long int, int, int>*; _Container = std::vector<std::tuple<long long int, int, int> >]':
citymapping.cpp:25:17: required from here
/usr/include/c++/10/bits/stl_iterator.h:980:4: error: cannot increment a pointer to incomplete type 'std::tuple<long long int, int, int>'
980 | ++_M_current;
| ^~~~~~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/vector:60,
from citymapping.cpp:2:
/usr/include/c++/10/type_traits: In instantiation of 'struct std::is_destructible<std::tuple<long long int, int, int> >':
/usr/include/c++/10/bits/stl_construct.h:177:51: required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::tuple<long long int, int, int>*]'
/usr/include/c++/10/bits/alloc_traits.h:738:15: required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator, std::allocator<_T2>&) [with _ForwardIterator = std::tuple<long long int, int, int>*; _Tp = std::tuple<long long int, int, int>]'
/usr/include/c++/10/bits/stl_vector.h:680:15: required from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::tuple<long long int, int, int>; _Alloc = std::allocator<std::tuple<long long int, int, int> >]'
citymapping.cpp:11:32: required from here
/usr/include/c++/10/type_traits:844:52: error: static assertion failed: template argument must be a complete class or an unbounded array
844 | static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/vector:65,
from citymapping.cpp:2:
/usr/include/c++/10/bits/stl_construct.h: In instantiation of 'void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::tuple<long long int, int, int>*]':
/usr/include/c++/10/bits/alloc_traits.h:738:15: required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator, std::allocator<_T2>&) [with _ForwardIterator = std::tuple<long long int, int, int>*; _Tp = std::tuple<long long int, int, int>]'
/usr/include/c++/10/bits/stl_vector.h:680:15: required from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::tuple<long long int, int, int>; _Alloc = std::allocator<std::tuple<long long int, int, int> >]'
citymapping.cpp:11:32: required from here
/usr/include/c++/10/bits/stl_construct.h:177:51: error: static assertion failed: value type is destructible
177 | static_assert(is_destructible<_Value_type>::value,
| ^~~~~
/usr/include/c++/10/bits/stl_construct.h:184:25: error: invalid use of incomplete type 'std::iterator_traits<std::tuple<long long int, int, int>*>::value_type' {aka 'class std::tuple<long long int, int, int>'}
184 | std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/vector:60,
from citymapping.cpp:2:
/usr/include/c++/10/type_traits:2631:11: note: declaration of 'std::iterator_traits<std::tuple<long long int, int, int>*>::value_type' {aka 'class std::tuple<long long int, int, int>'}
2631 | class tuple;
| ^~~~~
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/vector:64,
from citymapping.cpp:2:
/usr/include/c++/10/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::deallocate(_Tp*, __gnu_cxx::new_allocator<_Tp>::size_type) [with _Tp = std::tuple<long long int, int, int>; __gnu_cxx::new_allocator<_Tp>::size_type = long unsigned int]':
/usr/include/c++/10/bits/alloc_traits.h:492:23: required from 'static void std::allocator_traits<std::allocator<_Tp1> >::deallocate(std::allocator_traits<std::allocator<_Tp1> >::allocator_type&, std::allocator_traits<std::allocator<_Tp1> >::pointer, std::allocator_traits<std::allocator<_Tp1> >::size_type) [with _Tp = std::tuple<long long int, int, int>; std::allocator_traits<std::allocator<_Tp1> >::allocator_type = std::allocator<std::tuple<long long int, int, int> >; std::allocator_traits<std::allocator<_Tp1> >::pointer = std::tuple<long long int, int, int>*; std::allocator_traits<std::allocator<_Tp1> >::size_type = long unsigned int]'
/usr/include/c++/10/bits/stl_vector.h:354:19: required from 'void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(std::_Vector_base<_Tp, _Alloc>::pointer, std::size_t) [with _Tp = std::tuple<long long int, int, int>; _Alloc = std::allocator<std::tuple<long long int, int, int> >; std::_Vector_base<_Tp, _Alloc>::pointer = std::tuple<long long int, int, int>*; std::size_t = long unsigned int]'
/usr/include/c++/10/bits/stl_vector.h:335:2: required from 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::tuple<long long int, int, int>; _Alloc = std::allocator<std::tuple<long long int, int, int> >]'
/usr/include/c++/10/bits/stl_vector.h:487:7: required from here
/usr/include/c++/10/ext/new_allocator.h:123:6: error: invalid application of '__alignof__' to incomplete type 'std::tuple<long long int, int, int>'
123 | if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
| ^~~~~~~~~~~~
/usr/include/c++/10/ext/new_allocator.h:127:16: error: invalid application of 'sizeof' to incomplete type 'std::tuple<long long int, int, int>'
127 | __t * sizeof(_Tp),
| ^~~~~~~~~~~
/usr/include/c++/10/ext/new_allocator.h:129:27: error: invalid application of '__alignof__' to incomplete type 'std::tuple<long long int, int, int>'
129 | std::align_val_t(alignof(_Tp)));
| ^~~~~~~~~~~~
/usr/include/c++/10/ext/new_allocator.h:135:14: error: invalid application of 'sizeof' to incomplete type 'std::tuple<long long int, int, int>'
135 | , __t * sizeof(_Tp)
| ^~~~~~~~~~~