Submission #553354

#TimeUsernameProblemLanguageResultExecution timeMemory
553354uroskGap (APIO16_gap)C++14
30 / 100
46 ms2240 KiB
#include "gap.h" // __builtin_popcount(x) // __builtin_popcountll(x) #define here cerr<<"===========================================\n" #include <bits/stdc++.h> #define ld double #define ll long long #define ull unsigned long long #define llinf 100000000000000000LL // 10^17 #define iinf 2000000000 // 2*10^9 #define pb push_back #define popb pop_back #define fi first #define sc second #define endl '\n' #define pii pair<int,int> #define pll pair<ll,ll> #define pld pair<ld,ld> #define sz(a) int(a.size()) #define all(a) a.begin(),a.end() #define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;} using namespace std; ll n; ll t; ll findGap(int T, int N) { n = N; t = T; if(t==1){ ll l = 1,r = 1000000000; r*=r; vector<ll> v; while(l<=r){ ll x,y; if(sz(v)==n) break; MinMax(l,r,&x,&y); if(x==-1&&y==-1) break; if(x==y){ v.pb(x); break; }else{ v.pb(x); v.pb(y); r = y-1; l = x+1; } } sort(all(v)); ll ans = 0; for(ll i = 0;i<sz(v)-1;i++){ ans = max(ans,v[i+1]-v[i]); } return ans; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...