/* made by amunduzbaev */
#include "bits/stdc++.h"
using namespace std;
//~ #include <ext/pb_ds/assoc_container.hpp>
//~ #include <ext/pb_ds/tree_policy.hpp>
//~ using namespace __gnu_pbds;
//~ template<class T> using oset = tree<T,
//~ null_type, less_equal<T>, rb_tree_tag,
//~ tree_order_statistics_node_update>;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define NeedForSpeed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vv vector
#define mem(arr, v) memset(arr, v, sizeof arr)
#define int long long
#define degub(x) cout<<#x<<" : "<<x<<"\n"
#define GG cout<<"here"<<endl;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vii;
typedef vector<pii> vpii;
template<class T> bool umin(T& a, const T& b) { return a > b ? a = b, true : false; }
template<class T> bool umax(T& a, const T& b) { return a < b ? a = b, true : false; }
template<int sz> using tut = array<int, sz>;
void usaco(string s) { freopen((s+".in").c_str(),"r",stdin);
freopen((s+".out").c_str(),"w",stdout); NeedForSpeed }
const int N = 2e5+5;
const int mod = 1e9+7;
const ll inf = 1e18;
const ld Pi = acos(-1);
#define MULTI 0
int n, m, k, t, q, ans, res, a[N];
bool ask(int x, int y){
if(x <= 0 || y <= 0 || x > n || y > n) return 0;
cout<<"examine "<<x<<" "<<y<<endl;
cin>>x; return x;
}
void result(int x, int y){
cout<<"solution "<<x<<" "<<y<<endl;
return;
}
void solve(int t_case){
int x, y; cin>>n>>x>>y;
int l = 1, r = y, len = 0;
for(;y > (1<<len); len++){
if(ask(x, y - (1<<len))) continue;
l = y - (1<<len); break;
} while(l < r){
int m = (l + r)>>1;
if(ask(x, m)) r = m;
else l = m + 1;
} int lx, ly = l;
l = 1, r = x, len = 0;
for(;x > (1<<len); len++){
if(ask(x - (1<<len), y)) continue;
l = x - (1<<len); break;
} while(l < r){
int m = (l + r)>>1;
if(ask(m, y)) r = m;
else l = m + 1;
} lx = l;
l = y, r = n, len = 0;
for(;y + (1<<len) <= n; len++){
if(ask(x, y + (1<<len))) continue;
r = y + (1<<len); break;
} while(l < r){
int m = (l + r + 1)>>1;
if(ask(x, m)) l = m;
else r = m - 1;
} int rx, ry = l;
l = x, r = n, len = 0;
for(;x + (1<<len) <= n; len++){
if(ask(x + (1<<len), y)) continue;
r = x + (1<<len); break;
} while(l < r){
int m = (l + r + 1)>>1;
if(ask(m, y)) l = m;
else r = m - 1;
} rx = l;
//~ assert(rx - lx + 1 == ry - ly + 1);
m = rx - lx + 1;
assert(m&1);
for(int i=5;i>=1;i--){
for(int j=5;j>=1;j--){
int x = rx - m * i + 1, y = ry - m * j + 1;
if(ask(x, y)){
int xx = x + 5 * m - 1, yy = y + 5 * m - 1;
//~ assert(ask(xx, yy));
//~ x, xx
//~ y, yy
result((x + xx + 1)>>1, (y + yy + 1)>>1);
return;
}
}
}
}
signed main(){
NeedForSpeed
if(MULTI){
int t; cin>>t;
for(int t_case = 1; t_case <= t; t_case++) solve(t_case);
} else solve(1);
return 0;
}
Compilation message
aliens.cpp: In function 'void solve(long long int)':
aliens.cpp:68:12: warning: unused variable 'ly' [-Wunused-variable]
68 | } int lx, ly = l;
| ^~
aliens.cpp: In function 'void usaco(std::string)':
aliens.cpp:36:31: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
36 | void usaco(string s) { freopen((s+".in").c_str(),"r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aliens.cpp:37:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
37 | freopen((s+".out").c_str(),"w",stdout); NeedForSpeed }
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
412 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
440 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |