이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "gap.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("hard1.txt","r",stdin)
#define OUT freopen("hard1.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 1000005
using namespace __gnu_pbds;
using namespace std ;
typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;
#define INF 1000000000000000000LL
#define alpha 26
#define mod 998244353LL
#define maxn 500005
#define LOG 18
vector <i64> solve1(int n,i64 lo, i64 hi)
{
vector <i64> v ;
v.pb(lo) ; v.pb(hi) ;
for(int i=1 ; i<(n+1)/2 ; i++ )
{
lo++ ; hi-- ;
i64 mn , mx ;
MinMax(lo,hi,&mn,&mx) ;
v.pb(mn) ;
if(mn!=mx) v.pb(mx) ;
lo = mn ; hi = mx ;
}
sort( v.begin() , v.end() ) ;
return v ;
}
i64 findGap( int t , int n )
{
i64 mn , mx ;
MinMax(0,INF,&mn,&mx) ;
vector <i64> p ;
if(t==1) p = solve1(n,mn,mx) ;
i64 ans = 0 ;
for(int i=1 ; i<n ; i++) ans = max( ans , p[i]-p[i-1] ) ;
return ans ;
}
/*
int main()
{
return 0 ;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |