Submission #227627

#TimeUsernameProblemLanguageResultExecution timeMemory
227627Arg_007Gap (APIO16_gap)C++14
0 / 100
65 ms2352 KiB
#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) ; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...