#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
#define ll long long
//#define int ll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int ans(int a,int b,int pos){
if(b<a)return 0;
if(a==b)return a;
if(pos==a){
int x=Guess(b);
if(x==0)return (a+b)/2;
if(x==-1)return ans(a,(a+b-1)/2,b);
return ans((a+b+1)/2,b,b);
}
if(pos==b){
int k=Guess(a);
if(k==0)return (a+b)/2;
if(k==1)return ans(a,(a+b)/2,a);
return ans((a+b+1)/2,b,a);
}
int k=Guess(a);
int x=Guess(b);
if(x==0)return (a+b)/2;
if(x==-1)return ans(a,(a+b-1)/2,b);
return ans((a+b+1)/2,b,b);
}
int HC(int N){
return ans(1,N,-1);
}
Compilation message
hottercolder.cpp: In function 'int ans(int, int, int)':
hottercolder.cpp:23:7: warning: unused variable 'k' [-Wunused-variable]
int k=Guess(a);
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
1280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
1280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
27 ms |
1280 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
713 ms |
8160 KB |
Output is partially correct - alpha = 0.111111111111 |