Submission #712704

#TimeUsernameProblemLanguageResultExecution timeMemory
712704dungnguyenn_05Gap (APIO16_gap)C++17
0 / 100
50 ms2648 KiB
#include<bits/stdc++.h> #include "gap.h" #define pb push_back #define all(x) x.begin(),x.end() using namespace std; typedef long long ll; vector<ll> pre,suf; long long findGap(int T, int N) { long long s=0,t=1e18; ll mn,mx; while(s<=t) { MinMax(s,t,&mn,&mx); if(mn==-1) break; pre.pb(mn); suf.pb(mx); s=mn+1; t=mx-1; } reverse(all(suf)); for(ll x:suf) pre.pb(x); // for(ll x:pre) // cout<<x<<' '; // cout<<endl; sort(all(pre)); ll res=0; for(int i=1;i<pre.size();i++) res=max(res,pre[i]-pre[i-1]); return res; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:39:15: 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=1;i<pre.size();i++)
      |              ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...