| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1088091 | StefanSebez | Hotter Colder (IOI10_hottercolder) | C++14 | 778 ms | 24512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "grader.h"
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ld long double
int HC(int n){
//ofstream out("01.out");
//for(int i=1;i<=500;i++){for(int j=1;j<=i;j++) out<<i<<" "<<j<<endl;}
int l=1,r=n,ct=0,res=0;
vector<pair<int,int> >a;
while(l<=r){
//printf("%i %i\n",l,r);
if(r-l==2){
if(a.size() && a.back().se==r){
int x=Guess(l);
if(x==1) res=l;
else if(x==0) res=l+1;
else res=r;
}
else if(a.size() && a.back().se==l){
int x=Guess(r);
if(x==1) res=r;
else if(x==0) res=l+1;
else res=l;
}
else{
int x=Guess(l),y=Guess(r);
if(y==1) res=r;
else if(y==0) res=l+1;
else res=l;
}
break;
}
if(r-l==1){
if(a.size() && a.back().se==r){
a.pb({Guess(l),l});
if(a.back().fi==1) res=l;
else res=r;
}
else if(a.size() && a.back().se==l){
a.pb({Guess(r),r});
if(a.back().fi==1) res=r;
else res=l;
}
else{
int x=Guess(l),y=Guess(r);
if(y==1) res=r;
else res=l;
}
break;
}
if(l==r){res=l;break;}
int mid=l+r>>1;
if(ct%2==0){
a.pb({Guess(mid),mid});
a.pb({Guess(mid+1),mid+1});
if(a.back().fi==-1) r=mid;
else l=mid+1;
ct=1;
}
else{
if(a.back().se<=mid){
mid=r;
//printf("%i\n",mid);
a.pb({Guess(mid),mid});
if(a.back().fi==1) l=l+r+1>>1;
else r=l+r>>1;
}
else{
mid=l;
//printf("%i\n",mid);
a.pb({Guess(mid),mid});
if(a.back().fi==1) r=l+r+1>>1;
else l=l+r>>1;
}
ct=0;
}
}
return res;
}
컴파일 시 표준 에러 (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... | ||||
