Submission #45385

#TimeUsernameProblemLanguageResultExecution timeMemory
45385OneSubmissionManGap (APIO16_gap)C++11
Compilation error
0 ms0 KiB
# include "gap.h" # include <bits/stdc++.h> # define x first # define y second # define mp make_pair // everything go according to my plan # define pb push_back # define sz(a) (int)(a.size()) # define vec vector // shimkenttin kyzdary, dzyn, dzyn, dzyn... # define y1 Y_U_NO_y1 # define left Y_U_NO_left # define right Y_U_NO_right using namespace std; typedef pair <int, int> pii; typedef long long ll; typedef long double ld; const int Mod = (int)1e9 + 7; const int MX = 1073741822; const ll MXLL = 4e18; const int Sz = 1110111; // a pinch of soul const ll N = 1e18; ll solve_slow (int n) { ll a[n + 2]; a[n + 1] = N + 1; a[0] = -1; for (int l = 1; l <= (n + 1) / 2; l++) { int r = n - l + 1; MinMax (a[l - 1] + 1, a[r + 1] - 1, a + l, a + r); } ll ans = 0; for (int i = 1; i < n; i++) ans = max (ans, a[i + 1] - a[i]); return ans; } long findGap (int t, int n) { ll F, S; MinMax (1ll, N, &F, &S); ll len = max (1, (S - F - 1) / (n - 1)); ll last = F; ll ans = 1; for (int i = 1; i <= n; i++) { ll x, y; MinMax (F + 1 + (i - 1) * len, F + 1 + i * len - 1, &x, &y); if (~x) { ans = max (ans, x - last); last = y; } } return ans; } // Coded by Z..

Compilation message (stderr)

gap.cpp: In function 'long int findGap(int, int)':
gap.cpp:47:41: error: no matching function for call to 'max(int, ll)'
   ll len = max (1, (S - F - 1) / (n - 1));
                                         ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from gap.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
gap.cpp:47:41: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
   ll len = max (1, (S - F - 1) / (n - 1));
                                         ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from gap.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
gap.cpp:47:41: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
   ll len = max (1, (S - F - 1) / (n - 1));
                                         ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
gap.cpp:47:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   ll len = max (1, (S - F - 1) / (n - 1));
                                         ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
gap.cpp:47:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   ll len = max (1, (S - F - 1) / (n - 1));
                                         ^