Submission #409772

#TimeUsernameProblemLanguageResultExecution timeMemory
409772jeqchoGap (APIO16_gap)C++17
30 / 100
59 ms2284 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pair<int,int>> vpi; #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) #define pb push_back #define rsz resize #define sz(x) int(x.size()) #define all(x) begin(x), end(x) #define fi first #define se second long long findGap(int T, int N) { ll s=0; ll t=1e18; vector<ll>v; while(sz(v)!=N) { ll c,d; MinMax(s,t,&c,&d); v.pb(c); if(c!=d)v.pb(d); s=c+1; t=d-1; } sort(all(v)); ll rec=-1e9; F0R(i,N-1) { rec=max(rec,v[i+1]-v[i]); } return rec; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...