이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
#include <chrono>
#include "grader.h"
using namespace std;
// vector<int> returns;
// int ind=0;
// int Guess(int val)
// {
// cout << val << endl;
// return returns[ind++];
// }
int HC(int N)
{
if(N==1) return 1;
int mid = (1+N)/2;
int no_one_cares=Guess(mid);
int mid_gue_bump=Guess(mid+1); // do we need to use intelligence from the previous guess???
int l,r;
if(mid_gue_bump==-1)
{
l=1;
r=mid;
}
else
{
l=mid+1;
r=N;
}
while(l<r)
{
// cout << l << " " << r << endl;
int cur_mid=(l+r)/2;
Guess(cur_mid);
int cur = Guess(cur_mid+1);
if(cur==-1)
{
r=cur_mid;
}
else
{
l=cur_mid+1;
}
}
return l;
// int g = Guess(1);
// int h = Guess(N);
// if (g == 0) return N/2;
// if (g < 0) return N/4;
// if (g > 0) return 3*N/4;
}
// int main()
// {
// returns={0,-1,-1,-1,-1,-1,-1,1};
// cout << "GUESS: " << HC(10) << endl;
// }
컴파일 시 표준 에러 (stderr) 메시지
hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:30:6: warning: unused variable 'no_one_cares' [-Wunused-variable]
int no_one_cares=Guess(mid);
^~~~~~~~~~~~| # | 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... |