Submission #109436

#TimeUsernameProblemLanguageResultExecution timeMemory
109436PlurmGap (APIO16_gap)C++11
42.81 / 100
95 ms7044 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; set<long long> s; void recur(const int& N, long long lo, long long hi){ if(lo > hi) return; if(s.size() == N) return; long long mn, mx; MinMax(lo, hi, &mn, &mx); if(mn == -1ll) return; s.insert(mn); s.insert(mx); long long mid = (mn + mx)/2ll; recur(N, mn+1, mid); recur(N, mid, mx-1); } long long findGap(int T, int N) { long long mn, mx; if(T == 1){ long long lo = 0ll; long long hi = 1e18; do{ MinMax(lo, hi, &mn, &mx); if(mn == -1) break; s.insert(mn); s.insert(mx); lo = mn + 1; hi = mx - 1; }while(lo <= hi && s.size() < N); }else{ recur(N, 0ll, (long long)1e18); } vector<long long> v; for(long long x : s) v.push_back(x); mx = 0ll; for(int i = 1; i < N; i++){ mx = max(mx, v[i] - v[i-1]); } return mx; return 0; }

Compilation message (stderr)

gap.cpp: In function 'void recur(const int&, long long int, long long int)':
gap.cpp:8:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(s.size() == N) return;
        ~~~~~~~~~^~~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:31:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         }while(lo <= hi && s.size() < N);
                            ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...