Submission #71856

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
718562018-08-25 17:23:02비타오백 (#119)The Ant Doing Hard Work (FXCUP3_ant)C++17
Compilation error
0 ms0 KiB
#include "ant.h"
int FindK() {
int lo = 1, hi = 1e8;
int f = 0;
while(lo < hi) {
int mid = (lo + hi) / 2;
if(!f) f = 1, mid = (1<<26)-1;
int x = DeliverCount(mid);
if(!x) lo = mid + 1;
else {
lo = max(lo, (mid+x)/(x+1));
hi = min(hi, mid/x);
}
}
return lo;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

ant.cpp: In function 'int FindK()':
ant.cpp:11:9: error: 'max' was not declared in this scope
    lo = max(lo, (mid+x)/(x+1));
         ^~~
ant.cpp:12:9: error: 'min' was not declared in this scope
    hi = min(hi, mid/x);
         ^~~
ant.cpp:12:9: note: suggested alternative: 'mid'
    hi = min(hi, mid/x);
         ^~~
         mid