Submission #500626

# Submission time Handle Problem Language Result Execution time Memory
500626 2021-12-31T15:39:16 Z 600Mihnea Aliens (IOI07_aliens) C++17
0 / 100
3 ms 456 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

int dr[] = {-1, 0, 1, 0};
int dc[] = {0, 1, 0, -1};

vector<pair<int, int>> guys;


signed main() {
  int n, r0, c0;
  cin >> n >> r0 >> c0;

  int cnt = 0;
  function<bool(int, int)> is = [&] (int r, int c) {

    if (1 <= r && 1 <= c && r <= n && c <= n) {
      cnt++;
      if (cnt > 300 - 1) exit(0);
      cout << "examine " << r << " " << c << endl;
      string s;
      cin >> s;
      assert(s == "true" || s == "false");
      return (s == "true");
    }
    return false;
  };

  for (int k = 0; k < 3; k++) {
    int r = r0, c = c0;
    while (1) {
      pair<int, int> init = {r, c};

      for (int step = 1 << 30; step; step /= 2) {
        if (is(r + dr[k] * step, c + dc[k] * step)) {
          r += dr[k] * step;
          c += dc[k] * step;
        }
      }

      pair<int, int> fini = {r, c};

      if (init == fini) {
        break;
      }
    }
    guys.push_back({r, c});
  }


  assert(guys[3].second == guys[1].second - guys[2].first + guys[0].first);

  cout << "solution ";
  cout << (guys[0].first + guys[2].first) / 2 << " ";
  cout << (guys[1].second + guys[3].second) / 2 << endl;


  return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 420 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 328 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 424 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 444 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -