Submission #299919

#TimeUsernameProblemLanguageResultExecution timeMemory
299919pacha2880The Big Prize (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <prize.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define mp make_pair #define pb push_back #define all(a) (a).begin(), (a).end() #define sz(a) a.size() #define md(a, b) ((a) % b + b) % b #define mod(a) md(a, MOD) #define srt(a) sort(all(a)) #define mem(a, h) memset(a, (h), sizeof(a)) #define f first #define s second #define forn(i, n) for(int i = 0; i < n; i++) #define fore(i, b, e) for(int i = b; i < e; i++) #define forg(i, b, e, m) for(int i = b; i < e; i+=m) //int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;} using namespace std; //using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<ll> vll; //typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; //find_by_order kth largest order_of_key < const int tam = 100010; const int MOD = 1000000007; const int MOD1 = 998244353; const double EPS = 1e-9; const double PI = acos(-1); int find_best(int n) { int lo = 0, hi = n - 1, mid, res; pair<int, pair<int, int>> maxi{0,0}; fore(i, 0, 500) { auto ar = ask(i); if(ar[0] + ar[1] == 0) return i; maxi = max(maxi, mp(ar[0] + ar[1], {i, ar[0]})); } int can = maxi.f, pos = maxi.s.f, le = maxi.s.s; while(true) { lo = pos + 1, hi = n - 1; while(lo <= hi) { mid = (lo + hi) / 2; auto ar = ask(mid); if(ar[0] + ar[1] != can) pos = mid, hi = mid - 1; else { if(ar[0] > ar[le]) hi = mid - 1; else lo = mid + 1; } } while(true) { auto ar = ask(pos); if(ar[0] + ar[1] == 0) return pos; if(ar[0] + ar[1] == can) break; pos++; } } } // read the question correctly (is y a vowel? what are the exact constraints?) // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:41:36: error: no matching function for call to 'std::pair<int, std::pair<int, int> >::pair(<brace-enclosed initializer list>)'
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                    ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.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:
prize.cpp:41:36: note:   mismatched types 'std::tuple<_Tps ...>' and 'int'
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                    ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.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:
prize.cpp:41:36: note:   mismatched types 'std::tuple<_Tps ...>' and 'int'
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                    ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.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<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<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:
prize.cpp:41:36: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                    ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.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<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<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:
prize.cpp:41:36: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                    ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.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:
/usr/include/c++/9/bits/stl_pair.h:324:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
  324 |                          bool>::type=true>
      |                                      ^~~~
/usr/include/c++/9/bits/stl_pair.h:318:27: note: candidate: 'template<class _U1, typename std::enable_if<_MoveCopyPair<false, _U1, std::pair<int, 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, std::pair<int, 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:
prize.cpp:41:35: note:   cannot convert '0' (type 'int') to type 'const std::pair<int, int>&'
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                   ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.cpp:1:
/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 = std::pair<int, 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 = std::pair<int, 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<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<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:
prize.cpp:41:36: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                    ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.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<std::pair<int, int>, _U2>::value)), int, std::pair<int, int> >::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<std::pair<int, int>, _U2>::value)), int, std::pair<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:
prize.cpp:41:36: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                    ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.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:
prize.cpp:41:35: note:   cannot convert '0' (type 'int') to type 'const std::pair<int, int>&'
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                   ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.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:
prize.cpp:41:36: note:   candidate expects 0 arguments, 2 provided
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                    ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.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()
      |                          ^~~~
/usr/include/c++/9/bits/stl_pair.h:229:26: note:   template argument deduction/substitution failed:
prize.cpp:41:36: note:   candidate expects 0 arguments, 2 provided
   41 |  pair<int, pair<int, int>> maxi{0,0};
      |                                    ^
prize.cpp:47:48: error: no matching function for call to 'make_pair(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type, <brace-enclosed initializer list>)'
   47 |   maxi = max(maxi, mp(ar[0] + ar[1], {i, ar[0]}));
      |                                                ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from prize.cpp:1:
/usr/include/c++/9/bits/stl_pair.h:524:5: note: candidate: 'template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)'
  524 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
/usr/include/c++/9/bits/stl_pair.h:524:5: note:   template argument deduction/substitution failed:
prize.cpp:47:48: note:   couldn't deduce template parameter '_T2'
   47 |   maxi = max(maxi, mp(ar[0] + ar[1], {i, ar[0]}));
      |                                                ^
prize.cpp:40:31: warning: unused variable 'res' [-Wunused-variable]
   40 |  int lo = 0, hi = n - 1, mid, res;
      |                               ^~~