Submission #119274

#TimeUsernameProblemLanguageResultExecution timeMemory
119274eriksuenderhaufAliens (IOI07_aliens)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; char resp[30]; ll n, x, y; bool qry(ll x0, ll y0) { if (x0 > n || y0 > n || x0 < 1 || y0 < 1) return false; printf("examine %lld %lld\n", x0, y0); fflush(stdout); scanf("%s", resp); return resp[0] == 't'; } ll solveX(ll dir) { for (ll i = 1;; i *= 2) { if (qry(x + i * dir, y)) continue; if (i == 1) return x; ll lo = x + dir * i / 2, hi = x + dir * i; while (abs(hi - lo) > 1) { ll mi = (lo + hi) / 2; if (qry(mi, y)) lo = mi; else hi = mi; } return lo; } return dir > 0 ? n : 1; } ll solveY(ll dir) { for (ll i = 1;; i *= 2) { if (qry(x, y + i * dir)) continue; if (i == 1) return y; ll lo = y + dir * i / 2, hi = y + dir * i; while (abs(hi - lo) > 1) { ll mi = (lo + hi) / 2; if (qry(x, mi)) lo = mi; else hi = mi; } return lo; } return dir > 0 ? n : 1; } ll cnt[4]; ll dx[4] = {1, 0, -1, 0}; ll dy[4] = {0, 1, 0, -1}; int main() { scanf("%lld %lld %lld", &n, &x, &y); ll mxx = solveX(1), mix = solveX(-1); ll mxy = solveY(1), miy = solveY(-1); x = (mxx+mix) / 2; y = (mxy+miy) / 2; ll m = mxx - mix + 1; for (ll i = 0; i < 4; i++) { for (cnt[i] = 1; qry(x + 2 * m * dx[i] * cnt[i], y + 2 * m * dy[i] * cnt[i]); cnt[i]++); cnt[i]--; } if (cnt[0] == cnt[2] && cnt[1] == cnt[3]) return !printf("solution %lld %lld\n", x, y); x = x + m * (cnt[0] * dx[0] + cnt[2] * dx[2]); y = y + m * (cnt[1] * dy[1] + cnt[3] * dy[3]); printf("solution %lld %lld\n", x, y); return 0; }

Compilation message (stderr)

aliens.cpp:4:1: error: 'll' does not name a type
 ll n, x, y;
 ^~
aliens.cpp:6:10: error: 'll' was not declared in this scope
 bool qry(ll x0, ll y0) {
          ^~
aliens.cpp:6:17: error: 'll' was not declared in this scope
 bool qry(ll x0, ll y0) {
                 ^~
aliens.cpp:6:22: error: expression list treated as compound expression in initializer [-fpermissive]
 bool qry(ll x0, ll y0) {
                      ^
aliens.cpp:15:1: error: 'll' does not name a type
 ll solveX(ll dir) {
 ^~
aliens.cpp:32:1: error: 'll' does not name a type
 ll solveY(ll dir) {
 ^~
aliens.cpp:49:1: error: 'll' does not name a type
 ll cnt[4];
 ^~
aliens.cpp:50:1: error: 'll' does not name a type
 ll dx[4] = {1, 0, -1, 0};
 ^~
aliens.cpp:51:1: error: 'll' does not name a type
 ll dy[4] = {0, 1, 0, -1};
 ^~
aliens.cpp: In function 'int main()':
aliens.cpp:54:27: error: 'n' was not declared in this scope
  scanf("%lld %lld %lld", &n, &x, &y);
                           ^
aliens.cpp:54:27: note: suggested alternative: 'yn'
  scanf("%lld %lld %lld", &n, &x, &y);
                           ^
                           yn
aliens.cpp:54:31: error: 'x' was not declared in this scope
  scanf("%lld %lld %lld", &n, &x, &y);
                               ^
aliens.cpp:54:35: error: 'y' was not declared in this scope
  scanf("%lld %lld %lld", &n, &x, &y);
                                   ^
aliens.cpp:54:35: note: suggested alternative: 'yn'
  scanf("%lld %lld %lld", &n, &x, &y);
                                   ^
                                   yn
aliens.cpp:55:2: error: 'll' was not declared in this scope
  ll mxx = solveX(1), mix = solveX(-1);
  ^~
aliens.cpp:56:5: error: expected ';' before 'mxy'
  ll mxy = solveY(1), miy = solveY(-1);
     ^~~
aliens.cpp:57:7: error: 'mxx' was not declared in this scope
  x = (mxx+mix) / 2;
       ^~~
aliens.cpp:57:7: note: suggested alternative: 'fmax'
  x = (mxx+mix) / 2;
       ^~~
       fmax
aliens.cpp:57:11: error: 'mix' was not declared in this scope
  x = (mxx+mix) / 2;
           ^~~
aliens.cpp:57:11: note: suggested alternative: 'main'
  x = (mxx+mix) / 2;
           ^~~
           main
aliens.cpp:58:7: error: 'mxy' was not declared in this scope
  y = (mxy+miy) / 2;
       ^~~
aliens.cpp:58:11: error: 'miy' was not declared in this scope
  y = (mxy+miy) / 2;
           ^~~
aliens.cpp:58:11: note: suggested alternative: 'main'
  y = (mxy+miy) / 2;
           ^~~
           main
aliens.cpp:59:5: error: expected ';' before 'm'
  ll m = mxx - mix + 1;
     ^
aliens.cpp:60:10: error: expected ';' before 'i'
  for (ll i = 0; i < 4; i++) {
          ^
aliens.cpp:60:17: error: 'i' was not declared in this scope
  for (ll i = 0; i < 4; i++) {
                 ^
aliens.cpp:61:8: error: 'cnt' was not declared in this scope
   for (cnt[i] = 1; qry(x + 2 * m * dx[i] * cnt[i], y + 2 * m * dy[i] * cnt[i]); cnt[i]++);
        ^~~
aliens.cpp:61:8: note: suggested alternative: 'int'
   for (cnt[i] = 1; qry(x + 2 * m * dx[i] * cnt[i], y + 2 * m * dy[i] * cnt[i]); cnt[i]++);
        ^~~
        int
aliens.cpp:61:32: error: 'm' was not declared in this scope
   for (cnt[i] = 1; qry(x + 2 * m * dx[i] * cnt[i], y + 2 * m * dy[i] * cnt[i]); cnt[i]++);
                                ^
aliens.cpp:61:32: note: suggested alternative: 'tm'
   for (cnt[i] = 1; qry(x + 2 * m * dx[i] * cnt[i], y + 2 * m * dy[i] * cnt[i]); cnt[i]++);
                                ^
                                tm
aliens.cpp:61:36: error: 'dx' was not declared in this scope
   for (cnt[i] = 1; qry(x + 2 * m * dx[i] * cnt[i], y + 2 * m * dy[i] * cnt[i]); cnt[i]++);
                                    ^~
aliens.cpp:61:64: error: 'dy' was not declared in this scope
   for (cnt[i] = 1; qry(x + 2 * m * dx[i] * cnt[i], y + 2 * m * dy[i] * cnt[i]); cnt[i]++);
                                                                ^~
aliens.cpp:61:78: error: 'qry' cannot be used as a function
   for (cnt[i] = 1; qry(x + 2 * m * dx[i] * cnt[i], y + 2 * m * dy[i] * cnt[i]); cnt[i]++);
                                                                              ^
aliens.cpp:62:3: error: 'cnt' was not declared in this scope
   cnt[i]--;
   ^~~
aliens.cpp:62:3: note: suggested alternative: 'int'
   cnt[i]--;
   ^~~
   int
aliens.cpp:64:6: error: 'cnt' was not declared in this scope
  if (cnt[0] == cnt[2] && cnt[1] == cnt[3])
      ^~~
aliens.cpp:64:6: note: suggested alternative: 'int'
  if (cnt[0] == cnt[2] && cnt[1] == cnt[3])
      ^~~
      int
aliens.cpp:66:10: error: 'm' was not declared in this scope
  x = x + m * (cnt[0] * dx[0] + cnt[2] * dx[2]);
          ^
aliens.cpp:66:10: note: suggested alternative: 'tm'
  x = x + m * (cnt[0] * dx[0] + cnt[2] * dx[2]);
          ^
          tm
aliens.cpp:66:15: error: 'cnt' was not declared in this scope
  x = x + m * (cnt[0] * dx[0] + cnt[2] * dx[2]);
               ^~~
aliens.cpp:66:15: note: suggested alternative: 'int'
  x = x + m * (cnt[0] * dx[0] + cnt[2] * dx[2]);
               ^~~
               int
aliens.cpp:66:24: error: 'dx' was not declared in this scope
  x = x + m * (cnt[0] * dx[0] + cnt[2] * dx[2]);
                        ^~
aliens.cpp:67:24: error: 'dy' was not declared in this scope
  y = y + m * (cnt[1] * dy[1] + cnt[3] * dy[3]);
                        ^~