이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,x,y,M;
ll Lx,Rx,Ly,Ry;
ll l,r;
bool Query(ll m,bool f){ string s;
if (m < 1 || n < m) return 0;
if (f) cout << "examine " << m << " " << y << endl;
else cout << "examine " << x << " " << m << endl;
cin >> s; return s == "true";
}
void GoLR(bool f,ll &L,ll &R){
for (l=1, r=f?x:y; l<r; ){ ll m = (l+r)/2;
if (Query(m, f)) r = m;
else l = m+1;
}
L = l;
for (l=f?x:y, r=n; l<r; ){ ll m = (l+r+1)/2;
if (Query(m, f)) l = m;
else r = m-1;
}
R = r, M = R - L + 1;
if (M%3 == 0 && !Query(L + M/3, f) && Query(L + M/3 - 1, f)) M /= 3, R -= 2*M;
if (M%5 == 0 && !Query(L + M/5, f) && Query(L + M/5 - 1, f)) M /= 5, R -= 4*M;
for (; Query(L - 2*M, f); ) L -= 2*M, R -= 2*M;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> x >> y;
GoLR(1, Lx, Rx), GoLR(0, Ly, Ry);
cout << Lx << " " << Ly << " " << M << endl;
cout << "solution " << Lx + (5*M - 1)/2 << " " << Ly + (5*M - 1)/2 << endl;
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... |