Submission #753478

#TimeUsernameProblemLanguageResultExecution timeMemory
753478KN200711Gap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" # include <bits/stdc++.h> # define ll long long using namespace std; long long findGap(int T, int N) { ll lw = 0ll, hg = 0ll; MinMax(0ll, 1ll * 1e18, lw, hg); ll diff = hg - lw; diff = (diff + 1ll * N - 2ll) / (N - 1ll); ll ls = -1; while(lw < hg) { ll mn, mx; MinMax(lw, min(lw + diff, 1ll * 1e18), mn, mx); lw += diff + 1ll; if(mn == mx && mn == -1) continue; if(ls == -1) ls = mx; else { diff = max(diff, mn - ls); ls = mx; } } return diff; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:8:26: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    8 |  MinMax(0ll, 1ll * 1e18, lw, hg);
      |                          ^~
      |                          |
      |                          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:8:30: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    8 |  MinMax(0ll, 1ll * 1e18, lw, hg);
      |                              ^~
      |                              |
      |                              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:15:39: error: no matching function for call to 'min(long long int, double)'
   15 |   MinMax(lw, min(lw + diff, 1ll * 1e18), mn, mx);
      |                                       ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 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 gap.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
gap.cpp:15:39: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double')
   15 |   MinMax(lw, min(lw + diff, 1ll * 1e18), mn, mx);
      |                                       ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 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 gap.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
gap.cpp:15:39: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double')
   15 |   MinMax(lw, min(lw + diff, 1ll * 1e18), mn, mx);
      |                                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
gap.cpp:15:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |   MinMax(lw, min(lw + diff, 1ll * 1e18), mn, mx);
      |                                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
gap.cpp:15:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |   MinMax(lw, min(lw + diff, 1ll * 1e18), mn, mx);
      |                                       ^