# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
292278 | amiratou | Hotter Colder (IOI10_hottercolder) | C++14 | 3697 ms | 8312 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "grader.h"
#include <bits/stdc++.h>
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
map<pair<int,int>,int> mymap;
int HC(int N){
mymap.clear();
if(N==1)return 1;
if(N==2){
Guess(1);
if(Guess(2)==1)return 2;
return 1;
}
if(N==3){
Guess(1);
int k=Guess(3);
if(!k)return 2;
else if(k==1)return 3;
else return 1;
}
int l=1,r=N,a,b,last=-1,h;
if((r-l+1)<=5){
Guess(l),h=Guess(r-2);
if(!h)return l+1;
else if(h==-1)return l;
else{
h=Guess(r);
if(!h)return r-1;
else if(h==1)return r;
return r-2;
}
}
while((r-l+1)>7){
a=l+(r-l)/3,b=r-(r-l)/3;
int med=(a+b)>>1;
//cerr<<l<<" "<<r<<"\n";
//cerr<<a<<" "<<b<<"\n";
int A,B;
if(mymap.count({a,b}))
B=mymap[{a,b}];
else{
A=Guess(a),B=Guess(b),last=b;
mymap[{a,b}]=B;
}
if(!B)return (a+b)/2;
if(B==1)l=med+1;
else r=med-(!((a+b)&1));
}
//cerr<<l<<" "<<r<<"\n";
if((r-l+1)<=3){
if(mymap.count({l,r}))
h=mymap[{l,r}];
else Guess(l),h=Guess(r);
if(!h)return l+1;
else if(h==1)return r;
return l;
}
if((r-l+1)<=5){
Guess(l),h=Guess(r-2);
if(!h)return l+1;
else if(h==-1)return l;
else{
h=Guess(r);
if(!h)return r-1;
else if(h==1)return r;
return r-2;
}
}
Guess(l),h=Guess(l+2);
if(!h)return l+1;
else if(h==-1)
return l;
else{
h=Guess(r-2);
if(!h)return r-3;
else if(h==-1)return l+2;
else{
h=Guess(r);
if(!h)return r-1;
else if(h==1)return r;
return r-2;
}
}
}
컴파일 시 표준 에러 (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... |