Submission #338647

#TimeUsernameProblemLanguageResultExecution timeMemory
338647NicolaAbusaad2014Gap (APIO16_gap)C++14
30 / 100
77 ms6092 KiB
/** * Prof.Nicola **/ #include "gap.h" #include <bits/stdc++.h> using namespace std; template<class T>void re(T&x){cin>>x;} template<class T1,class T2> void re(pair<T1,T2>&x){re(x.first);re(x.second);} template<class T>void re(vector<T>&x){for(long i=0;i<x.size();i++){re(x[i]);}} template<class T>void re(deque<T>&x){for(long i=0;i<x.size();i++){re(x[i]);}} template<class T1,class T2> pair<T1,T2> mp(T1&x,T2&z){return make_pair(x,z);} long long findGap(int T, int N) { set<long long>s; set<long long>::iterator a,b; long long l=0,r=1e18,mn,mx; while(s.size()<N){ MinMax(l,r,&mn,&mx); l=mn+1; r=mx-1; s.insert(mn); s.insert(mx); } a=s.begin(); b=s.begin(); b++; long long ans=0; for(long i=1;i<s.size();i++){ ans=max(ans,(*b)-(*a)); a++; b++; } return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:18:19: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     while(s.size()<N){
      |           ~~~~~~~~^~
gap.cpp:29:19: warning: comparison of integer expressions of different signedness: 'long int' and 'std::set<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(long i=1;i<s.size();i++){
      |                  ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...