# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1154559 | salmon | Aliens (IOI07_aliens) | C++20 | 1 ms | 408 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
long long N;
long long X;
long long Y;
long long lX;
long long rX;
long long lY;
long long rY;
map<pair<int,int>,bool> mep;
bool inpoot(long long x, long long y){
if(x < 1 || y < 1) return false;
if(x > N || y > N) return false;
if(mep.find({x,y}) != mep.end()) return mep[make_pair(x,y)];
printf("examine %d %d\n",x,y);
fflush(stdout);
string s;
cin >> s;
return mep[{x,y}] = (s == "true");
}
int32_t main(){
scanf(" %lld",&N);
scanf(" %lld",&X);
scanf(" %lld",&Y);
int s = 1;
while(inpoot(s * 2 + X - 1,Y) || inpoot(X - s * 2 + 1,Y)) s *= 2;
if(s != 1){
lX = X;
rX = X;
if(inpoot(lX - s + 1,Y)) lX += - s + 1;
if(inpoot(rX + s - 1,Y)) rX += s - 1;
}
else{
lX = X;
rX = X;
}
//printf("%d %d\n",lX,rX);
int ns = 0;
int e = s - 1;
while(ns != e){
int m = (ns + e + 1)/2;
if(inpoot(lX - m,Y)){
ns = m;
}
else{
e = m - 1;
}
}
lX -= ns;
ns = 0;
e = s - 1;
while(ns != e){
int m = (ns + e + 1)/2;
if(inpoot(rX + m,Y)){
ns = m;
}
else{
e = m - 1;
}
}
rX += ns;
int L = rX - lX + 1;
//printf("%d %d %d\n",lX,rX,L);
lY = Y;
rY = Y;
ns = 0;
e = L - 1;
while(ns != e){
int m = (ns + e + 1)/2;
if(inpoot(X,lY - m)){
ns = m;
}
else{
e = m - 1;
}
}
lY -= ns;
rY = lY + L - 1;
X = (rX + lX)/2;
Y = (rY + lY)/2;
int temp;
int lcont = 0;
int rcont = 0;
while((lcont < 2) && inpoot(X - 2 * L * (1 + lcont), Y )) lcont++;
while((lcont + rcont < 2) && inpoot(X + 2 * L * (1 + rcont), Y )) rcont++;
rcont -= lcont;
int x = X;
X += rcont * L;
lcont = 0;
rcont = 0;
while((lcont < 2) && inpoot(x,Y - 2 * L * (1 + lcont) )) lcont++;
while((lcont + rcont < 2) && inpoot(x,Y + 2 * L * (1 + rcont) )) rcont++;
rcont -= lcont;
Y += rcont * L;
printf("solution %d %d\n",X,Y);
}
컴파일 시 표준 에러 (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... |
# | 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... |