Submission #445161

# Submission time Handle Problem Language Result Execution time Memory
445161 2021-07-16T17:02:58 Z JerryLiu06 Aliens (IOI07_aliens) C++17
0 / 100
2 ms 200 KB
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using ld = long double;
using db = double;
using str = string;
 
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;
 
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;
 
#define mp make_pair
#define f first
#define s second
 
#define sz(x) (int)(x).size()
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert 
#define ft front()
#define bk back()
#define pb push_back
#define pf push_front
 
#define lb lower_bound
#define ub upper_bound
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a)
#define EACH(a, x) for (auto& a : x)
 
ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); }
ll fdiv(ll a, ll b) { return a / b - ((a ^ b) < 0 && a % b); }
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
template<class T> void remDup(vector<T>& v) { sor(v); v.erase(unique(all(v)), v.end()); }
 
const int MOD = 1e9 + 7;
const int MX = 2e9;
const ll INF = 1e18;
 
ll N, X, Y; ll cX, cY, M;
 
bool isFlat(ll X, ll Y) {
    if (X <= 0 || X > N || Y <= 0 || Y > N) return false;
 
    cout << "examine" << " " << X << " " << Y << endl; 
 
    str res; cin >> res; return res[0] == 't';
}
 
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
 
    cin >> N >> X >> Y; ll lX = X, rX = X; ll bY = Y;
 
    R0F(i, 30) {
        if (isFlat(lX + (1 << i), Y) && isFlat(lX + (1 << i) / 2, Y) && isFlat(lX + (1 << i) / 4, Y)) lX += (1 << i);
        if (isFlat(rX - (1 << i), Y) && isFlat(rX - (1 << i) / 2, Y) && isFlat(rX - (1 << i) / 4, Y)) rX -= (1 << i);

        if (isFlat(X, bY - (1 << i)) && isFlat(X, bY - (1 << i) / 2) && isFlat(X, bY - (1 << i) / 4)) bY -= (1 << i);
    }
    M = 2 * (rX - lX + 1); cX = (lX + rX) / 2; cY = bY + M / 4;
 
    ll X0 = cX, X1 = cX; ll Y0 = cY, Y1 = cY;
 
    while (isFlat(X0 - M, cY)) X0 -= M;
    while (isFlat(X1 + M, cY)) X1 += M;
 
    while (isFlat(cX, Y0 - M)) Y0 -= M;
    while (isFlat(cX, Y1 + M)) Y1 += M;
 
    cout << "solution" << " " << (X0 + X1) / 2 << " " << (Y0 + Y1) / 2 << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -