# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
151841 | davitmarg | Hotter Colder (IOI10_hottercolder) | C++17 | 981 ms | 8184 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <stack>
#include <cassert>
#include <iterator>
#include <bitset>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
using namespace std;
#ifndef death
#include "grader.h";
#endif
#ifdef death
int Guess(int a)
{
cout<<"! "<<a<<endl;
int res;
cin>>res;
return res;
}
#endif
int last;
int guess(int x)
{
if(x==last)
return 0;
last=x;
return Guess(x);
}
int HC(int n)
{
int l=1;
int r=n;
int m1,m2;
int ans,k=0;
while(l<=r)
{
k++;
if(l==r)
{
ans=l;
break;
}
int len=(r-l);
m1=l+len/3;
m2=r-len/3;
int a2;
if(k%2)
{
a2=Guess(m1);
a2=Guess(m2);
}
else
{
a2=Guess(m2);
a2=Guess(m1);
a2*=-1;
}
if(a2==-1)
r=m2-1;
else if(a2==1)
l=m1+1;
else
{
l=m1+1;
r=m2-1;
}
}
return ans;
}
#ifdef death
int main()
{
cout<<HC(3)<<endl;
return 0;
}
#endif
/*
*/
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |