# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
633269 |
2022-08-22T02:59:20 Z |
Spade1 |
Aliens (IOI07_aliens) |
C++14 |
|
4 ms |
320 KB |
#include<bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<long long, long long>
//#define ll long long
#define ld long double
#define st first
#define nd second
#define pb push_back
#define INF INT_MAX
using namespace std;
const int N = 1e5 + 10;
int find_r(int l, int r, int y) {
while (l < r) {
int mid = (l+r+1)/2;
cout << "examine " << mid << " " << y << endl;
string s; cin >> s;
if (s == "true") l = mid;
else r = mid-1;
}
return l;
}
int find_l(int l, int r, int y) {
while (l < r) {
int mid = (l+r)/2;
cout << "examine " << mid << " " << y << endl;
string s; cin >> s;
if (s == "false") l = mid;
else r = mid-1;
}
return l+1;
}
int find_u(int l, int r, int x) {
while (l < r) {
int mid = (l+r+1)/2;
cout << "examine " << x << " " << mid << endl;
string s; cin >> s;
if (s == "true") l = mid;
else r = mid+1;
}
return l;
}
void solve() {
int n, x, y; cin >> n >> x >> y;
int jump, curx, cury, l, r;
jump = 1;
curx = x+1;
l = x, r = x;
while (1) {
if (curx > n) {
r = n;
break;
}
cout << "examine " << curx << " " << y << endl;
string s; cin >> s;
if (s == "true") {
l = curx;
jump *= 2;
curx += jump;
}
else {
r = curx-1;
break;
}
}
int r_edge = find_r(l, r, y);
jump = 1;
curx = x-1;
l = x, r = x;
while (1) {
if (curx < 1) {
l = 1;
break;
}
cout << "examine " << curx << " " << y << endl;
string s; cin >> s;
if (s == "true") {
r = curx-1;
jump *= 2;
curx -= jump;
}
else {
l = curx;
break;
}
}
int l_edge = find_l(l, r, y);
int M = r_edge - l_edge + 1;
jump = 1;
cury = y+1;
l = y, r = y;
while (1) {
if (cury > n) {
r = n;
break;
}
cout << "examine " << x << " " << cury << endl;
string s; cin >> s;
if (s == "true") {
l = cury;
jump *= 2;
cury += jump;
}
else {
r = cury-1;
break;
}
}
int u_edge = find_u(l, r, x);
int centerx = l_edge+M/2, centery = u_edge - M/2;
bool u = 0, d = 0, ll = 0, rr = 0;
if (centerx + 2*M <= n) {
cout << "examine " << centerx + 2*M << " " << centery << endl;
string s; cin >> s;
if (s=="true") rr = 1;
}
if (centery - 2*M >= 1) {
cout << "examine " << centerx << " " << centery - 2*M << endl;
string s;cin >> s;
if (s=="true") d = 1;
}
if (centerx - 2*M >= 1) {
cout << "examine " << centerx - 2*M << " " << centery << endl;
string s;cin >> s;
if (s=="true") ll = 1;
}
if (centery + 2*M <= n) {
cout << "examine " << centerx << " " << centery + 2*M << endl;
string s;cin >> s;
if (s=="true") u = 1;
}
if (u&&d&&ll&&rr) {
cout << "solution " << centerx << " " << centery << endl;
}
else if (u&&d&&ll) {
cout << "solution " << centerx - 2*M << " " << centery << endl;
}
else if (u&&d&&rr) {
cout << "solution " << centerx + 2*M << " " << centery << endl;
}
else if (u&&ll&rr) {
cout << "solution " << centerx << " " << centery + 2*M << endl;
}
else if (d&&ll&rr) {
cout << "solution " << centerx << " " << centery - 2*M << endl;
}
else if (d&rr) {
cout << "examine " << centerx - M << " " << centery + M << endl;
string s; cin >> s;
if (s == "true") cout << "solution " << centerx + M << " " << centery - M << endl;
else cout << "solution " << centerx + 2*M << " " << centery - 2*M << endl;
}
else if (u&rr) {
cout << "examine " << centerx - M << " " << centery - M << endl;
string s; cin >> s;
if (s == "true") cout << "solution" << centerx + M << " " << centery + M << endl;
else cout << "solution " << centerx + 2*M << " " << centery + 2*M << endl;
}
else if (d&ll) {
cout << "examine " << centerx + M << " " << centery + M << endl;
string s; cin >> s;
if (s == "true") cout << "solution " << centerx - M << " " << centery - M << endl;
else cout << "solution " << centerx - 2*M << " " << centery - 2*M << endl;
}
else if (u&ll) {
cout << "examine " << centerx + M << " " << centery - M << endl;
string s; cin >> s;
if (s == "true") cout << "solution " << centerx - M << " " << centery + M << endl;
else cout << "solution " << centerx - 2*M << " " << centery + 2*M << endl;
}
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(NULL);
int t = 1;
// cin >> t;
while (t--) {
solve();
}
}
# |
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 |
320 KB |
Execution killed with signal 13 |
2 |
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 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
312 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
208 KB |
Execution killed with signal 13 |
2 |
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 |
3 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
316 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
316 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |