이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define unen true
#define hud false
using namespace std;
typedef long long i64;
i64 n;
bool exam(i64 x, i64 y){
if(x < 1 || y < 1 || x > n || y > n) return 0;
cout << "examine " << x << ' ' << y << endl;
string ans;
cin >> ans;
return ans[0]=='t';
}
int main(){
i64 X, Y, x0, y0; // X, Y - chigluulegch
i64 zuun, baruun, deesh, doosh;
i64 usreh, l, r, m;
cin >> n >> x0 >> y0;
X = -1, Y = 0;
usreh = 1;
while( exam(x0 + X * usreh, y0 + Y * usreh) ){
usreh = usreh << 1;
}
l = usreh / 2, r = usreh;
while( l + 1 < r ){
i64 mid = (l + r) >> 1;
if( exam(x0 + X * mid, y0 + Y * mid) ) l = mid;
else r = mid - 1;
}
zuun = l;
//
X = 1, Y = 0;
usreh = 1;
while( exam(x0 + X * usreh, y0 + Y * usreh) ){
usreh = usreh << 1;
}
l = usreh / 2, r = usreh;
while( l + 1 < r ){
i64 mid = (l + r) >> 1;
if( exam(x0 + X * mid, y0 + Y * mid) ) l = mid;
else r = mid - 1;
}
baruun = l;
//
X = 0, Y = -1;
usreh = 1;
while( exam(x0 + X * usreh, y0 + Y * usreh) ){
usreh = usreh << 1;
}
l = usreh / 2, r = usreh;
while( l + 1 < r ){
i64 mid = (l + r) >> 1;
if( exam(x0 + X * mid, y0 + Y * mid) ) l = mid;
else r = mid - 1;
}
doosh = l;
//
X = 0, Y = 1;
usreh = 1;
while( exam(x0 + X * usreh, y0 + Y * usreh) ){
usreh = usreh << 1;
}
l = usreh / 2, r = usreh;
while( l + 1 < r ){
i64 mid = (l + r) >> 1;
if( exam(x0 + X * mid, y0 + Y * mid) ) l = mid;
else r = mid - 1;
}
deesh = l;
//
m = deesh + doosh + 1;
x0 = x0 - zuun + (m / 2); //centering
y0 = y0 - doosh + (m / 2);
//wtf ene yu yum be sd
while( exam(x0 - 2 * m, y0) ) x0 -= 2 * m;
while( exam(x0 - m, y0 - m) ) x0 -= m, y0 -= m;
while( exam(x0, y0 - 2 * m) ) y0 -= 2 * m;
cout << "solution " << x0 + 2 * m << ' ' << y0 + 2 * m << endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
aliens.cpp: In function 'int main()':
aliens.cpp:18:12: warning: variable 'baruun' set but not used [-Wunused-but-set-variable]
i64 zuun, baruun, deesh, doosh;
^~~~~~
# | 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... |