# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
779443 |
2023-07-11T12:10:13 Z |
vjudge1 |
Aliens (IOI07_aliens) |
C++17 |
|
3 ms |
208 KB |
#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 << "solution " << xCenter + (3 - a) * m << " " << yCenter + (3 - b) * m << endl;
}
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);
}
}
return 0;
}
Compilation message
aliens.cpp: In function 'int main()':
aliens.cpp:60:52: warning: variable 'idk8' set but not used [-Wunused-but-set-variable]
60 | bool idk1, idk2, idk3, idk4, idk5, idk6, idk7, idk8;
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
2 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Runtime error |
3 ms |
208 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Runtime error |
2 ms |
208 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |