Submission #404211

#TimeUsernameProblemLanguageResultExecution timeMemory
404211myrcellaGap (APIO16_gap)C++17
70 / 100
67 ms1180 KiB
#include "gap.h" #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pii pair<int,int> #define pll pair<long long,long long> #define pb push_back #define debug(x) cerr<<#x<<"="<<x<<endl #define pq priority_queue #define inf 0x3f #define rep(i,a,b) for (int i=a;i<(b);i++) #define MP make_pair #define SZ(x) (int(x.size())) #define ll long long #define mod 1000000007 #define ALL(x) x.begin(),x.end() void inc(int &a,int b) {a=(a+b)%mod;} void dec(int &a,int b) {a=(a-b+mod)%mod;} int lowbit(int x) {return x&(-x);} ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;} const ll MAX=1000000000000000000; long long findGap(int T, int N) { ll L,R; MinMax(0ll,MAX,&L,&R); ll mn=(R-L+N-2)/(N-1); ll ans=mn; ll lst=L; for (ll i=L+1;i<R;i+=mn) { ll tmp1,tmp2; MinMax(i,min(i+mn-1,R),&tmp1,&tmp2); if (tmp1!=-1) { ans=max(ans,tmp1-lst); lst=tmp2; } } return max(R-lst,ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...