Submission #751178

#TimeUsernameProblemLanguageResultExecution timeMemory
751178sofija6Gap (APIO16_gap)C++14
30 / 100
49 ms2256 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; long long findGap(int T, int N) { if (T==1) { long long l=0,r=1e18,ans=-1; vector<long long> a; while (true) { if (l>r || a.size()==N) break; long long curl,curr; MinMax(l,r,&curl,&curr); if (curl==-1) break; a.push_back(curl); if (curr!=curl) a.push_back(curr); l=curl+1; r=curr-1; } sort(a.begin(),a.end()); for (long long i=1;i<a.size();i++) ans=max(ans,a[i]-a[i-1]); return ans; } }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:14:32: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |             if (l>r || a.size()==N)
      |                        ~~~~~~~~^~~
gap.cpp:27:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for (long long i=1;i<a.size();i++)
      |                            ~^~~~~~~~~
gap.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...