Submission #249697

# Submission time Handle Problem Language Result Execution time Memory
249697 2020-07-15T14:50:35 Z WLZ Aliens (IOI07_aliens) C++14
20 / 100
2 ms 384 KB
#include <bits/stdc++.h>
using namespace std;



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, x_0, y_0;
  cin >> n >> x_0 >> y_0;
  int k = -1;
  string s;
  do {
    k++;
    cout << "examine " << x_0 + (1ll << k) << ' ' << y_0 << endl;
    cin >> s;
  } while (s == "true");
  long long lo = x_0, hi = x_0 + (1ll << k);
  while (lo < hi) {
    long long mid = (lo + hi) / 2;
    cout << "examine " << mid << ' ' << y_0 << endl;
    cin >> s;
    if (s == "true") {
      lo = mid + 1;
    } else {
      hi = mid;
    }
  }
  long long x_r = lo - 1;
  k = -1;
  do {
    k++;
    cout << "examine " << x_0 << ' ' << y_0  + (1ll << k) << endl;
    cin >> s;
  } while (s == "true");
  lo = y_0, hi = y_0 + (1ll << k);
  while (lo < hi) {
    long long mid = (lo + hi) / 2;
    cout << "examine " << x_0 << ' ' << mid << endl;
    cin >> s;
    if (s == "true") {
      lo = mid + 1;
    } else {
      hi = mid;
    }
  }
  long long y_r = lo - 1;
  k = -1;
  do {
    k++;
    cout << "examine " << x_0 - (1ll << k) << ' ' << y_0 << endl;
    cin >> s;
  } while (s == "true");
  lo = x_0 - (1ll << k), hi = x_0;
  while (lo < hi) {
    long long mid = (lo + hi + 1) / 2;
    cout << "examine " << mid << ' ' << y_0 << endl;
    cin >> s;
    if (s == "true") {
      hi = mid - 1;
    } else {
      lo = mid;
    }
  }
  long long x_l = lo + 1;
  long long m = x_r - x_l + 1;
  x_0 = x_r - (m - 1) / 2;
  y_0 = y_r - (m - 1) / 2;
  vector<bool> x(5, false);
  for (int i = -2; i <= 2; i++) {
    if (x_0 + 2 * i * m < 1 || x_0 + 2 * i * m > n) {
      continue;
    }
    cout << "examine " << x_0 + 2 * i * m << ' ' << y_0 << endl;
    cin >> s;
    x[i + 2] = (s == "true");
  }
  vector<bool> y(5, false);
  for (int i = -2; i <= 2; i++) {
    if (y_0 + 2 * i * m < 1 || y_0 + 2 * i * m > n) {
      continue;
    }
    cout << "examine " << x_0 << ' ' << y_0 + 2 * i * m << endl;
    cin >> s;
    y[i + 2] = (s == "true");
  }
  if (x[3] && x[4]) {
    x_0 += 2 * m;
  } else if (x[0] && x[1]) {
    x_0 -= 2 * m;
  } else if (x[1] && !x[3]) {
    x_0 -= m;
  } else {
    x_0 += m;
  }
  if (y[3] && y[4]) {
    y_0 += 2 * m;
  } else if (y[0] && y[1]) {
    y_0 -= 2 * m;
  } else if (y[1] && !y[3]) {
    y_0 -= m;
  } else {
    y_0 += m;
  }
  cout << "solution " << x_0 << ' ' << y_0 << endl;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Incorrect
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -