#include "grader.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int step = 0;
int HC(int N){
++step;
srand(N * step);
int l = 1,r = N;
int prev = -1;
while (l < r) {
int cnt;
if (prev == l) {
cnt = Guess(r);
prev = r;
} else
if (prev == r) {
cnt = Guess(l);
prev = l;
cnt *= -1;
} else {
if (rand() & 1) {
Guess(l);
cnt = Guess(r);
} else {
Guess(r);
cnt = Guess(l);
cnt *= -1;
}
}
if (!cnt)
return (l + r) / 2;
if (cnt == 1) {
l = (l + r + 2) / 2;
} else {
r = (l + r - 1) / 2;
}
}
return l;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
247 ms |
1352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
236 ms |
1400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
234 ms |
1276 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2667 ms |
8200 KB |
Output is partially correct - alpha = 0.068965517241 |