#include "grader.h"
// char dp[501][501][501];
// short select[501][501][501];
// char dfs(const int l, const int r, const int x) {
// if (l == r) return 0;
// if (dp[l][r][x] != 0) return dp[l][r][x];
// char min = 100;
// for (int i = 1; i < x; ++i) {
// const int m = (i + x) / 2;
// char max = 0;
// max = std::max();
// }
// }
int HC(int N) {
int l = 1, r = N, x = 1;
Guess(x);
while (l < r) {
if (x == l) {
const int t = Guess(r);
x = r;
if (t == 0) return (l + r) / 2;
else if (t == 1) l = (l + r) / 2 + 1;
else r = (l + r - 1) / 2;
} else {
if (x != r) {
Guess(r);
}
const int t = Guess(l);
x = l;
if (t == 0) return (l + r) / 2;
else if (t == 1) r = (l + r - 1) / 2;
else l = (l + r) / 2 + 1;
}
}
return l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
1228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
1268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
1264 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
610 ms |
8008 KB |
Output is partially correct - alpha = 0.172413793103 |