# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
77134 |
2018-09-22T18:44:04 Z |
doowey |
Aliens (IOI07_aliens) |
C++14 |
|
3 ms |
500 KB |
#pragma optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;
typedef pair<ll,int> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ab(x) ((x) < 0 ? -(x) : (x))
#define all(x) ((x).begin(),(x).end())
#define len(x) ((int)(x).size())
ll n;
bool ask(ll xi, ll yi){
if(xi <= 0)
return false;
if(yi <= 0)
return false;
if(xi > n)
return false;
if(yi > n)
return false;
cout << "examine " << xi << " " << yi << "\n";
fflush(stdout);
string answer;
cin >> answer;
return answer == "true";
}
int main(){
ll x0, y0;
cin >> n >> x0 >> y0;
ll L = x0 + 1, R = x0 + 1;
for(ll i = 0;i < 32; i ++ ){
if(!ask(x0 + (1 << i), y0)){
R = x0 + (1 << i);
break;
}
}
ll md;
ll lasx, lasy;
while(L < R){
md = (L + R) / 2;
if(ask(md, y0))
L = md + 1;
else
R = md;
}
ll tl = R - x0;
lasx = R - 1;
R = x0;
L = x0;
for(ll i = 0;i < 32; i ++ ){
if(!ask(x0 - (1 << i), y0)){
L = x0 - (1 << i);
break;
}
}
while(L < R){
md = (L + R) / 2;
if(ask(md, y0))
R = md;
else
L = md + 1;
}
tl += x0 - L;
ll M = tl;
L = y0, R = y0 + M - 1;
while(L < R){
md = (L + R) / 2;
if(!ask(x0, md))
R = md;
else
L = md + 1;
}
-- L;
lasy = L + 1;
for(ll i = 1;i <= 3; i ++ ){
if(ask(lasx + 2 * M, lasy))
lasx += 2 * M;
else
break;
}
for(ll i = 1; i <= 3; i ++ ){
if(ask(lasx, lasy + 2 * M))
lasy += 2 * M;
else
break;
}
if(ask(lasx + M, lasy + M))
lasx += M, lasy += M;
cout << "solution " << lasx << " " << lasy << "\n";
return 0;
}
Compilation message
aliens.cpp:1:0: warning: ignoring #pragma optimize [-Wunknown-pragmas]
#pragma optimize ("O3")
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
324 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
420 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
420 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
472 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
500 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
500 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
500 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |