답안 #500627

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
500627 2021-12-31T15:40:09 Z 600Mihnea Aliens (IOI07_aliens) C++17
80 / 100
4 ms 236 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 < 4; 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Incorrect 4 ms 200 KB Unexpected end of file - token expected
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 236 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
3 Incorrect 4 ms 200 KB Unexpected end of file - token expected
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
3 Correct 3 ms 200 KB Output is correct