Submission #431309

# Submission time Handle Problem Language Result Execution time Memory
431309 2021-06-17T10:52:20 Z milleniumEeee Aliens (IOI07_aliens) C++17
100 / 100
3 ms 248 KB
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
#define pb push_back
#define szof(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define int long long
template<class T>void chmax(T &a, T b){if (a < b)a = b;}
template<class T>void chmin(T &a, T b){if (b < a)a = b;}
using namespace std;
 
 
const int KEK = -1337;
 
int n, x, y;
 
int pw(int x) {
	return (1ll << x);
}
 
bool in(int pos) {
	return pos >= 1 && pos <= n;
}
 
bool ask(int x, int y) {
        if (x <= 0 || y <= 0 || x > n || y > n) {
            return false;
        }
        std::cout << "examine " << x << " " << y << std::endl;
        std::string res;
        std::cin >> res;
        return res == "true";
};
 
signed main() {
	cin >> n >> x >> y;
    for (int i = 2; ; i *= 2) {
        if (!ask(x, y + i)) {
            for (int j = i / 2; j > 0; j /= 2) {
                if (ask(x, y + j)) {
                    y += j;
                }
            }
            break;
        }
    }
    for (int i = 2; ; i *= 2) {
        if (!ask(x + i, y)) {
            for (int j = i / 2; j > 0; j /= 2) {
                if (ask(x + j, y)) {
                    x += j;
                }
            }
            break;
        }
    }
    int X = x, Y = y;
    for (int i = 2; ; i *= 2) {
        if (!ask(X, Y - i)) {
            for (int j = i / 2; j > 0; j /= 2) {
                if (ask(X, Y - j)) {
					Y -= j;
                }
            }
            break;
        }
    }
    int len = y - Y + 1;
    while (ask(x + len, y + len)) {
        x += len;
        y += len;
    }
    while (ask(x, y + len * 2)) {
        y += len * 2;
    }
    while (ask(x + len * 2, y)) {
        x += len * 2;
    }
    cout << "solution " << x - len * 2 - len / 2 << " " << y - len * 2 - len / 2 << endl;
} // wtf?
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 3 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct