이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
typedef pair<ll,pl> ppl;
const ll lim=2e5+5;
inline bool query(ll x,ll y){
cout<<"examine "<<x<<" "<<y<<"\n";
cout.flush();
string s;
cin>>s;
return (s=="true");
}
int main(){
ios_base::sync_with_stdio(0),cin.tie(NULL);
ll n,x,y;
cin>>n>>x>>y;
int dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
ll dist[4]={n-x,x-1,n-y,y-1},tsa[4];
for(int i=0;i<4;i++){
ll left = 0, right = dist[i], best = 0; //Binary search for the largest value that is red. Some modifications due to checkerboard
bool vroomed=0;
while(left<=right){
ll mid = (left+right)/2;
if(query(x + mid * dx[i], y + mid * dy[i])){
if(vroomed){
best = max(best, mid);
left = mid + 1;
}
else{
vroomed = true;
mid /= 2;
while(mid){
if(!query(x + mid * dx[i], y + mid * dy[i]))right = mid - 1;
mid /= 2;
}
}
}
else{
right = mid - 1;
}
if(i<2)tsa[i]=x+dx[i]*best;
else tsa[i]=y+dy[i]*best;
}
}
//cout<<"\n\n";
//for(int i=0;i<4;i++)cout<<tsa[i]<<" ";
assert(tsa[1]-tsa[0]==tsa[3]-tsa[2]);
cout<<"solution 1 1\n";
cout.flush();
return 0;
}
# | 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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |