Submission #371356

#TimeUsernameProblemLanguageResultExecution timeMemory
371356SortingGap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; using namespace std; const int INF = 1e18; int t, n; ll solve_1(){ ll l, r, ans = 0; MinMax(0, INF, l, r); ll l2, r2; n -= 2; while(n >= 0){ MinMax(l + 1, r - 1, l2, r2); ans = max(ans, max(l2 - l), max(r - r2)); l = l2, r = r2; } ans = max(ans, r - l); return ans; } ll findGap(int _t, int _n){ t = _t, n = _n; return solve_1(); }

Compilation message (stderr)

gap.cpp:9:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    9 | const int INF = 1e18;
      |                 ^~~~
gap.cpp: In function 'll solve_1()':
gap.cpp:15:20: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   15 |     MinMax(0, INF, l, r);
      |                    ^
      |                    |
      |                    ll {aka long long int}
In file included from gap.cpp:1:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:15:23: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   15 |     MinMax(0, INF, l, r);
      |                       ^
      |                       |
      |                       ll {aka long long int}
In file included from gap.cpp:1:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:20:30: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   20 |         MinMax(l + 1, r - 1, l2, r2);
      |                              ^~
      |                              |
      |                              ll {aka long long int}
In file included from gap.cpp:1:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:20:34: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   20 |         MinMax(l + 1, r - 1, l2, r2);
      |                                  ^~
      |                                  |
      |                                  ll {aka long long int}
In file included from gap.cpp:1:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:21:34: error: no matching function for call to 'max(ll)'
   21 |         ans = max(ans, max(l2 - l), max(r - r2));
      |                                  ^
In file included 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 gap.cpp:2:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
gap.cpp:21:34: note:   candidate expects 2 arguments, 1 provided
   21 |         ans = max(ans, max(l2 - l), max(r - r2));
      |                                  ^
In file included 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 gap.cpp:2:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
gap.cpp:21:34: note:   candidate expects 3 arguments, 1 provided
   21 |         ans = max(ans, max(l2 - l), max(r - r2));
      |                                  ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
gap.cpp:21:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |         ans = max(ans, max(l2 - l), max(r - r2));
      |                                  ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
gap.cpp:21:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |         ans = max(ans, max(l2 - l), max(r - r2));
      |                                  ^
gap.cpp:21:47: error: no matching function for call to 'max(ll)'
   21 |         ans = max(ans, max(l2 - l), max(r - r2));
      |                                               ^
In file included 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 gap.cpp:2:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
gap.cpp:21:47: note:   candidate expects 2 arguments, 1 provided
   21 |         ans = max(ans, max(l2 - l), max(r - r2));
      |                                               ^
In file included 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 gap.cpp:2:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
gap.cpp:21:47: note:   candidate expects 3 arguments, 1 provided
   21 |         ans = max(ans, max(l2 - l), max(r - r2));
      |                                               ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3456 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
gap.cpp:21:47: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |         ans = max(ans, max(l2 - l), max(r - r2));
      |                                               ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
gap.cpp:21:47: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   21 |         ans = max(ans, max(l2 - l), max(r - r2));
      |                                               ^