Submission #39803

#TimeUsernameProblemLanguageResultExecution timeMemory
3980314kgGap (APIO16_gap)C++11
30 / 100
92 ms9052 KiB
#include "gap.h" #include <set> #define NUM_MAX 1000000000000000000 #define max2(x,y) (x>y?x:y) using namespace std; int n; set<long long> S; long long f1() { long long l = 0, r = NUM_MAX; long long t1, t2, res = 0; while (l <= r) { MinMax(l, r, &t1, &t2); if (t1 < 0) break; S.insert(l = t1), S.insert(r = t2); l++, r--; if (S.size() == n) break; } t1 = NUM_MAX; for (auto i : S) res = max2(res, i - t1), t1 = i; return res; } long long findGap(int T, int _n) { n = _n; if (T == 1) return f1(); else; }

Compilation message (stderr)

gap.cpp: In function 'long long int f1()':
gap.cpp:20:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (S.size() == n) break;
                ^
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...