Submission #229985

#TimeUsernameProblemLanguageResultExecution timeMemory
229985kshitij_sodaniGap (APIO16_gap)C++17
59.04 / 100
83 ms3308 KiB
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long llo; #define mp make_pair #define a first #define b second #define pb push_back #include "gap.h" /*void MinMax(llo aa,llo bb,llo &cc,llo &dd){ cout<<aa<<" "<<bb<<endl; llo x,y; cin>>x>>y; cc=x; dd=y; }*/ llo findGap(int t,int n){ if(t==2){ llo low,high; MinMax(0,1e18,&low,&high); // cout<<0<<" "<<(llo)1e18<<endl; // cin>>low>>high; llo di=(high-low)/((llo)(n-1)); vector<llo> ans; ans.pb(low); ans.pb(high); for(llo i=low+1;i<=high;i+=di){ llo ss,tt; MinMax(i,i+di-1,&ss,&tt); // cout<<i<<" "<<i+di-1<<endl; // cin>>ss>>tt; if(ss==-1 or tt==-1){ continue; } ans.pb(ss); ans.pb(tt); } llo ans2=0; sort(ans.begin(),ans.end()); for(llo i=0;i<ans.size()-1;i++){ ans2=max(ans2,ans[i+1]-ans[i]); } return ans2; } } /*int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout<<findGap(2,4)<<endl; return 0; }*/

Compilation message (stderr)

gap.cpp: In function 'llo findGap(int, int)':
gap.cpp:41:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(llo i=0;i<ans.size()-1;i++){
               ~^~~~~~~~~~~~~
gap.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...