Submission #1091036

#TimeUsernameProblemLanguageResultExecution timeMemory
1091036NurislamGap (APIO16_gap)C++17
0 / 100
51 ms2480 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #include "gap.h" typedef long long ll; vector<ll> a; void so(ll l, ll r, int n){ ll mn = 1, mx = 1; MinMax(l, r, &mn, &mx); if(mn == -1)return; a.pb(mn); if(mx != mn)a.pb(mx); if(mn == mx || a.size() >= n)return; l = mn+1; r = mx-1; ll m = (r+l)>>1; so(l, m, n); so(m+1, r, n); } long long findGap(int t, int n) { so(0, 1e18, n); sort(all(a)); ll ans = 1; for(int i = 1; i < a.size(); i++) ans = max(ans, a[i] - a[i-1]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'void so(ll, ll, int)':
gap.cpp:20:26: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |  if(mn == mx || a.size() >= n)return;
      |                 ~~~~~~~~~^~~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:34:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |  for(int i = 1; i < a.size(); i++)
      |                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...