# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
779390 | teamariaa | Aliens (IOI07_aliens) | C++17 | 0 ms | 0 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>
using namespace std;
int n, m, x, y, ansx, ansy, st1, dr1, st2, dr2;
bool examine(int x, int y)
{
string s;
if(x > n || x < 1 || y > n || y < 1)
return 0;
cout << "examine " << x << " " << y << endl;
cin >> s;
if(s == "true")
return 1;
return 0;
}
void output(int a, int b)
{
cout << a << " " << b << endl;
int xCenter = x - st1 + m / 2;
int yCenter = y - st2 + m / 2;
cout << xCenter + (3 - a) * m << " " << yCenter + (3 - b) * m << endl;
return 0;
}
int main()
{
ios_base :: sync_with_stdio(0);
cin.tie(0);
cin >> n >> x >> y;
string s;
bool isSet = 1;
for(int i = x + 1; i <= n && isSet; i ++)
{
isSet = examine(i, y);
dr1 += isSet;
}
isSet = 1;
for(int i = x - 1; i >= 1 && isSet; i --)
{
isSet = examine(i, y);
st1 += isSet;
}
m = st1 + dr1 + 1;
///
isSet = 1;
for(int i = y + 1; i <= n && isSet; i ++)
{
isSet = examine(x, i);
dr2 += isSet;
}
st2 = m - dr2 - 1;
bool idk1, idk2, idk3, idk4, idk5, idk6, idk7, idk8;
idk1 = examine(x + 2 * m, y);
idk2 = examine(x + 4 * m, y);
idk3 = examine(x - 2 * m, y);
idk4 = examine(x - 4 * m, y);
idk5 = examine(x, y + 2 * m);
idk6 = examine(x, y + 4 * m);
idk7 = examine(x, y - 2 * m);
idk8 = examine(x, y - 4 * m);
if(idk1 && idk2)
{
//x : 1
if(idk5 && idk6)
output(1, 1);
else if(idk5 && idk6 == 0)
output(1, 3);
else if(idk5 == 0 && idk6 == 0)
output(1, 5);
}
else if(idk1 && idk2 == 0)
{
//x : 2 3
if(idk3)
{
//x : 3
if(idk5 && idk6)
output(3, 1);
else if(idk5 && idk6 == 0)
output(3, 3);
else if(idk5 == 0 && idk6 == 0)
output(3, 5);
}
else
{
//x : 2
if(idk5)
output(2, 2);
else
output(2, 4);
}
}
else if(idk1 == 0 && idk2 == 0)
{
//x : 4 5
if(idk4)
{
if(idk5 && idk6)
output(5, 1);
else if(idk5 && idk6 == 0)
output(5, 3);
else if(idk5 == 0 && idk6 == 0)
output(5, 5);
//x : 5
}
else
{
//x : 4
if(idk7)
output(4, 4);
else
output(4, 2);
}
}
}