# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
521675 |
2022-02-02T17:53:27 Z |
perchuts |
Aliens (IOI07_aliens) |
C++17 |
|
4 ms |
236 KB |
#include <bits/stdc++.h>
#define maxn (int)(1e5+51)
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define ll long long
#define pb push_back
#define ull unsigned long long
#define ii pair<int,int>
#define iii tuple<int,int,int>
#define inf 2000000001
#define mod 1000000007 //998244353
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
template<typename X, typename Y> bool ckmin(X& x, const Y& y) { return (y < x) ? (x=y,1):0; }
template<typename X, typename Y> bool ckmax(X& x, const Y& y) { return (x < y) ? (x=y,1):0; }
int q = 0;
void tle(){
while(true){
cout<<"a"<<endl;
}
}
bool query(ll x,ll y){
q++;
cout<<"examine "<<x<<" "<<y<<endl;
string s;cin>>s;
if(q==296)tle();
return s=="true";
}
int main(){_
ll n,x0,y0;cin>>n>>x0>>y0;
ll l,r,leftmost = x0,rightmost = x0,topmost = y0;
bool ok = true;
while(ok){
ok = false;
l = 1LL, r = leftmost-1LL;
while(l<=r){
ll md = l + (r-l+1LL)/2;
if(query(md,y0)){
leftmost = md;
r = md-1LL;
ok = true;
}else{
l = md+1LL;
}
}
}
//rightmost
ok = true;
while(ok){
ok = false;
l = rightmost + 1LL, r = n;
while(l<=r){
ll md = l + (r-l+1LL)/2;
if(query(md,y0)){
rightmost = md;
l = md+1LL;
ok = true;
}else r = md-1LL;
}
}
//topmost
ok = true;
while(ok){
l = topmost+1LL, r = n;
ok = false;
while(l<=r){
ll md = l + (r-l+1)/2;
if(query(x0,md)){
topmost = md;
l = md+1LL;
ok = true;
}else r = md-1LL;
}
}
ll len = rightmost - leftmost + 1;
ll xc = leftmost + len/2, yc = topmost - len/2;
cout<<"solution "<<xc<<" "<<yc<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
220 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
236 KB |
Output is correct |
3 |
Correct |
3 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
3 |
Correct |
4 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
3 |
Correct |
2 ms |
200 KB |
Output is correct |