# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
431343 | juggernaut | Aliens (IOI07_aliens) | C++17 | 3 ms | 280 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
void usaco(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
typedef long long ll;
#define USING_ORDERED_SET 0
#if USING_ORDERED_SET
#include<bits/extc++.h>
using namespace __gnu_pbds;
template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#endif
template<class T>void umax(T &a,T b){if(a<b)a=b;}
template<class T>void umin(T &a,T b){if(b<a)a=b;}
#ifdef IOI2021SG
#define printl(args...)printf(args)
#else
#define printl(args...)((void)0)
#endif
ll n;
bool check(ll x,ll y){
if(!(x&&y&&x<=n&&y<=n))return false;
printf("examine %lld %lld\n",x,y);
fflush(stdout);
string s;
cin>>s;
return s=="true";
}
int main(){
ll x,y;
cin>>n>>x>>y;
ll l,r;
l=0,r=x-1;
while(l<r){
ll mid=(l+r+1)>>1;
if(check(x-mid,y))l=mid;
else{
if(check(x-mid,y-mid))l=mid;
else if(check(x-mid,y+mid))l=mid;
else r=mid-1;
}
}
ll x1=x-l;
l=0,r=n-x;
while(l<r){
ll mid=(l+r+1)>>1;
if(check(x+mid,y))l=mid;
else{
if(check(x+mid,y-mid))l=mid;
else if(check(x+mid,y+mid))l=mid;
else r=mid-1;
}
}
ll x2=x+l;
l=0,r=y-1;
while(l<r){
ll mid=(l+r+1)>>1;
if(check(x,y-mid))l=mid;
else{
if(check(x-mid,y-mid))l=mid;
else if(check(x+mid,y-mid))l=mid;
else r=mid-1;
}
}
ll y1=y-l;
ll y2=y1+(x2-x1);
printf("solution %lld %lld\n",(x1+x2)/2,(y1+y2)/2);
}
Compilation message (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... |