# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
880452 |
2023-11-29T12:48:23 Z |
8pete8 |
Aliens (IOI07_aliens) |
C++14 |
|
1 ms |
596 KB |
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define endl "\n"
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
#define int long long
using namespace std;
const int mod=1e9+7,mxn=2e5+5,lg=30,inf=1e18,minf=-1e18;
int m,n;
bool ask(int x,int y){
if(x<=0||y<=0||y>n||x>n)return false;
cout<<"examine "<<x<<" "<<y<<'\n'<<flush;
/*
if(y>=1&&y<=3&&x>=2&&x<=4)return true;
if(y>=7&&y<=9&&x>=2&&x<=4)return true;
if(y>=13&&y<=15&&x>=2&&x<=4)return true;
return false;
*/
string s;cin>>s;
return s=="true";
}
pii getcen(){
int x,y;cin>>n>>x>>y;
int up=minf,down=inf,right=minf;
int l,r,mid,nm,cx,cy;
bool check=false;
l=y,r=n;
while(l<=r){
check=false;
mid=(l+r)/2;
if(mid-y<=3)check=ask(x,mid);
else{
nm=(y+mid)/2;
check=(ask(x,mid)&&ask(x,nm)&&ask(x,(y+nm)/2));
}
if(check)l=mid+1,up=max(up,mid);
else r=mid-1;
}
l=1,r=y;
while(l<=r){
check=false;
mid=(l+r)/2;
if(y-mid<=3)check=ask(x,mid);
else{
nm=(y+mid)/2;
check=(ask(x,mid)&&ask(x,nm)&&ask(x,(y+nm)/2));
}
if(check)r=mid-1,down=min(down,mid);
else l=mid+1;
}
m=up-down+1;
cy=(up+down)/2;
l=x,r=n;
while(l<=r){
check=false;
mid=(l+r)/2;
if(mid-x<=3)check=ask(mid,y);
else{
nm=(x+mid)/2;
check=(ask(mid,y)&&ask(nm,y)&&ask((x+nm)/2,y));
}
if(check)l=mid+1,right=max(right,mid);
else r=mid-1;
}
cx=(right+(right-m+1))/2;
return {cx,cy};
}
void solve(){
pii pos=getcen();
int cl=0,cr=0,cx=pos.f,cy=pos.s;
while(ask(cx+2*m,cy))cx+=2*m,cr++;
cy=pos.s;
while(ask(cx-2*m,cy))cx-=2*m,cl++;
while(ask(cx,cy-2*m))cy-=2*m;
if(cl+cr+1==2)cout<<"solution "<<cx+m<<" "<<cy+m<<'\n'<<flush;
else cout<<"solution "<<cx+2*m<<" "<<cy+2*m<<'\n'<<flush;
return;
}
int32_t main(){
fastio
solve();
return 0;
}
Compilation message
aliens.cpp:31:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
31 | #pragma GCC optimize ("03,unroll-lopps")
| ^
aliens.cpp:36:21: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
36 | bool ask(int x,int y){
| ^
aliens.cpp:49:12: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
49 | pii getcen(){
| ^
aliens.cpp:95:12: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
95 | void solve(){
| ^
aliens.cpp:106:14: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
106 | int32_t main(){
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
504 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Incorrect |
1 ms |
344 KB |
Incorrect |
4 |
Halted |
0 ms |
0 KB |
- |