제출 #403512

#제출 시각아이디문제언어결과실행 시간메모리
403512teehandsomeGap (APIO16_gap)C++11
30 / 100
59 ms1944 KiB
#include "gap.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define endl '\n' #define INF 1e9+7 #define all(x) x.begin(),x.end() using namespace std; using namespace __gnu_pbds; using ll=long long; using pii=pair<int,int>; using ppi=pair<int,pii>; using oset=tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>; template<typename T> void _print(vector<T> x) {cerr<<"{"; for(auto e:x) cerr<<e<<","; cerr<<"}";} void _print(pii x) {cerr<<"{"<<x.first<<","<<x.second<<"}";} template<typename T> void _print(T x) {cerr<<x;} void dbg() {cerr<<endl;} template<typename Head,typename... Tail> void dbg(Head H,Tail... T) { _print(H); if(sizeof...(T)) cerr<<","; else cerr<<"\"]"; dbg(T...); } #define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:[\"",dbg(__VA_ARGS__) //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n,t; long long findGap(int T, int N) { n=N,t=T; vector<ll> a(n); ll l=0,r=1e18; int li=0,ri=n-1; for(int i=0;i<(n+1)/2;i++) { if(li>ri) break; ll mn,mx; MinMax(l,r,&mn,&mx); a[li++]=mn; a[ri--]=mx; l=mn+1; r=mx-1; } ll ans=0; for(int i=1;i<n;i++) { ans=max(ans,a[i]-a[i-1]); } // debug(a); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...