Submission #1091033

#TimeUsernameProblemLanguageResultExecution timeMemory
1091033NurislamGap (APIO16_gap)C++17
0 / 100
3062 ms2448 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 solve1(ll l, ll r, int n){ ll lf = 1, rf = 1; MinMax(l, r, &lf, &rf); cout << lf << ' ' << rf << '\n'; if(lf == -1)return; a.pb(lf); if(lf != rf)a.pb(rf); if(lf == rf || a.size() >= n)return; l = lf + 1; r = rf - 1; ll len = sqrt(r-l)+1; ll last = l; while(last <= r){ solve1(last, min(last + len, r), n); last += len + 1; } } long long findGap(int t, int n) { solve1(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 solve1(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(lf == rf || a.size() >= n)return;
      |                 ~~~~~~~~~^~~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:37:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for(int i = 1; i < a.size(); i++)
      |                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...