# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1074666 | DeathIsAwe | Hotter Colder (IOI10_hottercolder) | C++17 | 437 ms | 8188 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "grader.h"
#include <iostream>
#include <vector>
using namespace std;
int destroy(int top, int bottom, int previous) {
//cout << top << ' ' << bottom << '\n';
if (top - bottom == 0) {
return top;
} else if (top - bottom == 1) {
int sussy, ans;
if (previous == -1) {
Guess(top); sussy = Guess(bottom);
}
if (sussy == 1) {
ans = bottom;
} else {
ans = top;
}
return ans;
}
int mid = (top + bottom) / 2;
int midleft = (bottom + mid) / 2;
int midright = (mid + 1 + top) / 2;
if (previous == -1) {
int midleftans = Guess(midleft), midrightans = Guess(midright);
if (midrightans == 0) {
return (midleft + midright) / 2;
} else if (midrightans == 1) {
return destroy(top, mid + 1, -1);
} else {
if ((midleft + midright) % 2 == 0) {
return destroy(mid - 1, bottom, -1);
}
return destroy(mid, bottom, -1);
}
}
}
int HC(int n){
int ans = destroy(n, 1, -1);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |