# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
300088 | a_player | Gap (APIO16_gap) | C++14 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long findGap(int T, int N){
if(T==1){
ll mx, mn;
vector<ll> a(N);
MinMax(0,2e18,mn,mx);
a[0]=mn;
a[N-1]=mx;
int i=1;
while(mx!=mn){
MinMax(mn+1,mx-1,mn,mx);
if(mn==-1)break;
a[i]=mn;
a[N-i-1]=mx;
i++;
}
int ans=0;
for(int i=1;i<N;i++)ans=max(ans,a[i]-a[i-1]);
cout<<ans;
return 0;
}
ll mn,mx;
MinMax(0,2e18,mn,mx);
ll d=(mx-mn+N-1)/N;
ll a=mn+1;
ll b=mn+d;
ll l=mn;
ll ans=0;
for(int i=0;i<N;i++){
if(b>=mx)b=mx-1;
if(s>e)break;
ll mnn,mxx;
MinMax(a,b,mnn,mxx);
if(mnn!=-1){
ans=max(ans,mnn-l);
l=mxx;
}
a+=d;
b+=d;
}
ans=max(ans,mx-l);
cout<<ans;
return 0;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)': gap.cpp:10:19: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive] 10 | MinMax(0,2e18,mn,mx); | ^~ | | | 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:10:22: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive] 10 | MinMax(0,2e18,mn,mx); | ^~ | | | 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:15:24: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive] 15 | MinMax(mn+1,mx-1,mn,mx); | ^~ | | | 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:27: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive] 15 | MinMax(mn+1,mx-1,mn,mx); | ^~ | | | 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:22:48: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 22 | for(int i=1;i<N;i++)ans=max(ans,a[i]-a[i-1]); | ^ In file included from /usr/include/c++/9/bits/char_traits.h:39, from /usr/include/c++/9/ios:40, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, 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:22:48: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 22 | for(int i=1;i<N;i++)ans=max(ans,a[i]-a[i-1]); | ^ In file included from /usr/include/c++/9/bits/char_traits.h:39, from /usr/include/c++/9/ios:40, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, 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:22:48: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 22 | for(int i=1;i<N;i++)ans=max(ans,a[i]-a[i-1]); | ^ 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:22:48: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | for(int i=1;i<N;i++)ans=max(ans,a[i]-a[i-1]); | ^ 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:22:48: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | for(int i=1;i<N;i++)ans=max(ans,a[i]-a[i-1]); | ^ gap.cpp:27:17: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive] 27 | MinMax(0,2e18,mn,mx); | ^~ | | | 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:27:20: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive] 27 | MinMax(0,2e18,mn,mx); | ^~ | | | 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:35:8: error: 's' was not declared in this scope 35 | if(s>e)break; | ^ gap.cpp:35:10: error: 'e' was not declared in this scope 35 | if(s>e)break; | ^ gap.cpp:37:16: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive] 37 | MinMax(a,b,mnn,mxx); | ^~~ | | | 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:37:20: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive] 37 | MinMax(a,b,mnn,mxx); | ^~~ | | | 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*); | ^~~~~~~~~~