# include "grader.h"
# include <bits/stdc++.h>
# define x first
# define y second
# define mp make_pair
// everything go according to my plan
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1 Y_U_NO_y1
# define left Y_U_NO_left
# define right Y_U_NO_right
using namespace std;
typedef pair <int, int> pii;
typedef long long ll;
typedef long double ld;
const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
int solve_slow (int n) {
int l = 1, r = n;
while (l < r) {
int mid = (l+r) >> 1;
int res;
Guess (l); res = Guess (r);
if (!res)
return mid;
if (res < 0)
r = mid- (r - l % 2 == 0);
else
l = mid+1;
}
return l;
}
int HC (int n) {
return solve_slow (n);
if (n == 1)
return 1;
int l, r, last;
l = 1, r = n;
Guess (n); last = n;
while (r - l > 1) {
int m = (l+r) >> 1;
cout << l << ' ' << r << endl;
if (2*m <= last)
m ++;
int op, res;
if (last == m) {
op = (l + m) / 2;
cout << op << endl;
res = -Guess (op);
}
else {
op = 2*m - last;
cout << op << endl;
res = Guess (op);
if (last > m)
res = -res;
}
cout << l << ' ' << r << ' ' << last << ' ' << op << ' ' << res << endl;
if (!res)
return m;
if (res > 0)
l = m;
else
r = m;
last = op;
}
if (l == r)
return l;
Guess (l);
int res = Guess (r);
if (res < 0)
return l;
else
return r;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
1272 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
770 ms |
8212 KB |
Output isn't correct - alpha = 0.000000000000 |