Submission #503949

#TimeUsernameProblemLanguageResultExecution timeMemory
503949Carmel_Ab1Gap (APIO16_gap)C++17
13.38 / 100
66 ms3292 KiB
#include <bits/stdc++.h> using namespace std; #include "gap.h" typedef long long ll; typedef vector<ll> vl; #define all(x) x.begin(),x.end() #define pb push_back ll ceil(ll a,ll b){return (a+b-1)/b;} ll findGap(int T, int n){ ll L=0,R=1e18; MinMax(0,1e18,&L,&R); ll block=ceil(R-L+1,n); vl a={L,R}; for(int i=0; i<n; i++){ ll l=L+i*block; ll r=l+block-1; while(l<r){ MinMax(l,r,&l,&r); if(l==-1)break; a.pb(l); a.pb(r); l++,r--; } if(l==r && l!=-1) a.pb(l); } ll ans=0; sort(all(a)); for(int i=0; i+1<a.size(); i++) ans=max(ans,a[i+1]-a[i]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:39:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for(int i=0; i+1<a.size(); i++)
      |                  ~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...