Submission #1075760

#TimeUsernameProblemLanguageResultExecution timeMemory
1075760TB_Scales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; #define ll long long #define fo(i, n) for(ll i = 0; i<(n); i++) #define F first #define S second #define pb push_back #define deb(x) cout << #x << " = " << (x) << endl #define deb2(x, y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl typedef vector<ll> vl; typedef vector<vl> vvl; // int getLightest(int a, int b, int c){ // cout << "light\n"; // cout << a << " " << b << " " << c << endl; // ll res; // cin >> res; // return res; // } // int getMedian(int a, int b, int c){ // cout << "Median\n"; // cout << a << " " << b << " " << c << endl; // ll res; // cin >> res; // return res; // } void init(int T) { } void orderCoins() { int W[] = {-1, -1, -1, -1, -1, -1}; vl order = {1, 2, 3, 4, 5, 6}; fo(i, 20) swap(order[rand()%6, rand()%6]); int t1 = getLightest(order[1], order[2], order[3]); int t2 = getLightest(order[4], order[5], order[0]); vector<int> a1, a2; fo(i, 6){ if(t1!=i+1 && (i+1 == order[1]||i+1 == order[2]||i+1 == order[3]))a1.pb(i+1); if(t2!=i+1 && (i+1 == order[0]||i+1 == order[5]||i+1 == order[4]))a2.pb(i+1); } int dist = 1; while(dist==t1||dist==t2)dist++; W[0] = getLightest(t1, t2, dist); if(t1==W[0]){ W[1] = getLightest(t2, a1[0], a1[1]); }else{ W[1] = getLightest(t1, a2[0], a2[1]); } vector<int> left; fo(i, 6){ if(i+1==W[0] || i+1 == W[1]) continue; left.pb(i+1); } int res = getLightest(left[0], left[1], left[2]); int other = left[0]; if(other == res) other = left[1]; int res2 = getMedian(res, other, left[3]); if(res2 == res){ W[2] = left[3]; W[3] = res; W[4] = getMedian(left[0], left[1], left[2]); }else{ W[2] = res; left.clear(); fo(i, 6){ if(i+1==W[0] || i+1 == W[1] || i+1 == W[2]) continue; left.pb(i+1); } W[3] = getLightest(left[0], left[1], left[2]); W[4] = getMedian(left[0], left[1], left[2]); } fo(i, 6){ if(i+1==W[0] || i+1==W[1] || i+1==W[2] || i+1 == W[3]|| i+1 == W[4]) continue; W[5] = i+1; } // fo(i, 6) deb(W[i]); answer(W); } // int main(){ // orderCoins(); // return 0; // }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:35:15: warning: unused parameter 'T' [-Wunused-parameter]
   35 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:41:32: warning: value computed is not used [-Wunused-value]
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                          ~~~~~~^~
scales.cpp:41:45: error: no matching function for call to 'swap(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included 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 scales.cpp:1:
/usr/include/c++/10/sstream:849:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>&)'
  849 |     swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/10/sstream:849:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included 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 scales.cpp:1:
/usr/include/c++/10/sstream:856:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>&)'
  856 |     swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/10/sstream:856:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included 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 scales.cpp:1:
/usr/include/c++/10/sstream:863:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>&)'
  863 |     swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/10/sstream:863:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included 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 scales.cpp:1:
/usr/include/c++/10/sstream:870:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>&)'
  870 |     swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
      |     ^~~~
/usr/include/c++/10/sstream:870:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from scales.cpp:1:
/usr/include/c++/10/bits/regex.h:849:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&, std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&)'
  849 |     swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
      |     ^~~~
/usr/include/c++/10/bits/regex.h:849:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from scales.cpp:1:
/usr/include/c++/10/bits/regex.h:2141:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(std::__cxx11::match_results<_BiIter, _Alloc>&, std::__cxx11::match_results<_BiIter, _Alloc>&)'
 2141 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
/usr/include/c++/10/bits/regex.h:2141:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included 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/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 scales.cpp:1:
/usr/include/c++/10/bits/move.h:189:5: note: candidate: 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)'
  189 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/10/bits/move.h:189:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   candidate expects 2 arguments, 1 provided
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included 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/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 scales.cpp:1:
/usr/include/c++/10/bits/move.h:213:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<std::__is_swappable<_Tp>::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
  213 |     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
      |     ^~~~
/usr/include/c++/10/bits/move.h:213:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types '_Tp [_Nm]' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
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 scales.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:533:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)'
  533 |     swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
      |     ^~~~
/usr/include/c++/10/bits/stl_pair.h:533:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
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 scales.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:541:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)' (deleted)
  541 |     swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
      |     ^~~~
/usr/include/c++/10/bits/stl_pair.h:541:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included from /usr/include/c++/10/string:55,
                 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 scales.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6420:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6420 |     swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~
/usr/include/c++/10/bits/basic_string.h:6420:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from scales.cpp:1:
/usr/include/c++/10/array:321:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> typename std::enable_if<typename std::__array_traits<_Tp, _Nm>::_Is_swappable::value>::type std::swap(std::array<_Tp, _Nm>&, std::array<_Tp, _Nm>&)'
  321 |     swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
      |     ^~~~
/usr/include/c++/10/array:321:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::array<_Tp, _Nm>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from scales.cpp:1:
/usr/include/c++/10/array:329:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> typename std::enable_if<(! typename std::__array_traits<_Tp, _Nm>::_Is_swappable::value)>::type std::swap(std::array<_Tp, _Nm>&, std::array<_Tp, _Nm>&)' (deleted)
  329 |     swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&) = delete;
      |     ^~~~
/usr/include/c++/10/array:329:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::array<_Tp, _Nm>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from scales.cpp:1:
/usr/include/c++/10/tuple:1629:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(std::tuple<_Tps ...>&, std::tuple<_Tps ...>&)'
 1629 |     swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
      |     ^~~~
/usr/include/c++/10/tuple:1629:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::tuple<_Tps ...>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from scales.cpp:1:
/usr/include/c++/10/tuple:1637:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<(! std::__and_<std::__is_swappable<_Elements>...>::value)>::type std::swap(std::tuple<_Tps ...>&, std::tuple<_Tps ...>&)' (deleted)
 1637 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
/usr/include/c++/10/tuple:1637:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::tuple<_Tps ...>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included from /usr/include/c++/10/functional:59,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from scales.cpp:1:
/usr/include/c++/10/bits/std_function.h:720:5: note: candidate: 'template<class _Res, class ... _Args> void std::swap(std::function<_Res(_ArgTypes ...)>&, std::function<_Res(_ArgTypes ...)>&)'
  720 |     swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y) noexcept
      |     ^~~~
/usr/include/c++/10/bits/std_function.h:720:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::function<_Res(_ArgTypes ...)>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included from /usr/include/c++/10/bits/node_handle.h:39,
                 from /usr/include/c++/10/bits/hashtable.h:37,
                 from /usr/include/c++/10/unordered_map:46,
                 from /usr/include/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from scales.cpp:1:
/usr/include/c++/10/optional:1196:5: note: candidate: 'template<class _Tp> std::enable_if_t<(is_move_constructible_v<_Tp> && is_swappable_v<_Tp>)> std::swap(std::optional<_Tp>&, std::optional<_Tp>&)'
 1196 |     swap(optional<_Tp>& __lhs, optional<_Tp>& __rhs)
      |     ^~~~
/usr/include/c++/10/optional:1196:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::optional<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   41 |     fo(i, 20) swap(order[rand()%6, rand()%6]);
      |                                             ^
In file included from /usr/include/c++/10/bits/node_handle.h:39,
                 from /usr/include/c++/10/bits/hashtable.h:37,
                 from /usr/include/c++/10/unordered_map:46,
                 from /usr/include/c++/10/functional:61,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from scales.cpp:1:
/usr/include/c++/10/optional:1202:5: note: candidate: 'template<class _Tp> std::enable_if_t<(!(is_move_constructible_v<_Tp> && is_swappable_v<_Tp>))> std::swap(std::optional<_Tp>&, std::optional<_Tp>&)' (deleted)
 1202 |     swap(optional<_Tp>&, optional<_Tp>&) = delete;
      |     ^~~~
/usr/include/c++/10/optional:1202:5: note:   template argument deduction/substitution failed:
scales.cpp:41:45: note:   mismatched types 'std::optional<_Tp>' and '__gnu_cx