이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 NN;
int ans(int a,int b,int pos){
if(b<a)return 0;
if(a==b)return a;
if(pos<=a){
if(b+a-pos>NN){
Guess(a);
pos=a;
}
int x=Guess(b+a-pos);
if(x==0)return (a+b)/2;
if(x==-1)return ans(a,(a+b-1)/2,b+a-pos);
return ans((a+b+1)/2,b,b+a-pos);
}
if(pos>=b){
if(a-(pos-b)<1){
Guess(b);
pos=b;
}
int k=Guess(a-(pos-b));
if(k==0)return (a+b)/2;
if(k==1)return ans(a,(a+b-1)/2,a-(pos-b));
return ans((a+b+1)/2,b,a-(pos-b));
}
/*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){
NN=N;
Guess(1);
return ans(1,N,1);
}
컴파일 시 표준 에러 (stderr) 메시지
hottercolder.cpp: In function 'int ans(int, int, int)':
hottercolder.cpp:38:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# | 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... |