Submission #1154547

#TimeUsernameProblemLanguageResultExecution timeMemory
1154547salmonAliens (IOI07_aliens)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long long long N; long long X; long long Y; long long lX; long long rX; long long lY; long long rY; bool inpoot(long long x, long long y){ if(x < 1 || y < 1) return false; if(x > N || y > N) return false; printf("examine %d %d\n",x,y); fflush(stdout); string s; cin >> s; return s == "true"; } int main(){ scanf(" %lld",&N); scanf(" %lld",&X); scanf(" %lld",&Y); int s = 1; while(inpoot(s + X - 1,Y) || inpoot(X - s + 1,Y)) s *= 2; if(s != 1) s/=2; if(s != 1){ lX = X; rX = X; while(inpoot(lX - s + 1,Y)) lX += - s + 1; while(inpoot(rX + s - 1,Y)) rX += s - 1; } //printf("%d %d\n",lX,rX); int ns = 0; int e = s - 1; while(ns != e){ int m = (ns + e + 1)/2; if(inpoot(lX - m,Y)){ ns = m; } else{ e = m - 1; } } lX -= ns; ns = 0; e = s - 1; while(ns != e){ int m = (ns + e + 1)/2; if(inpoot(rX + m,Y)){ ns = m; } else{ e = m - 1; } } rX += ns; int L = rX - lX + 1; //printf("%d %d %d\n",lX,rX,L); lY = Y; rY = Y; ns = 0; e = L - 1; while(ns != e){ int m = (ns + e + 1)/2; if(inpoot(X,lY - m)){ ns = m; } else{ e = m - 1; } } lY -= ns; ns = 0; e = L - 1; while(ns != e){ int m = (ns + e + 1)/2; if(inpoot(X,rY + m)){ ns = m; } else{ e = m - 1; } } rY += ns; X = (rX + lX)/2; Y = (rY + lY)/2; int temp; int lcont = 0; int rcont = 0; while(inpoot(X - 2 * L * (1 + lcont), Y )) lcont++; while(inpoot(X + 2 * L * (1 + rcont), Y )) rcont++; rcont -= lcont; int x = X; X += rcont * L; lcont = 0; rcont = 0; while(inpoot(x,Y - 2 * L * (1 + lcont) )) lcont++; while(inpoot(x,Y + 2 * L * (1 + rcont) )) rcont++; Y += rcont * L; printf("solution %d %d\n",X,Y); }

Compilation message (stderr)

aliens.cpp: In function 'bool inpoot(long long int, long long int)':
aliens.cpp:16:22: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   16 |     printf("examine %d %d\n",x,y);
      |                     ~^       ~
      |                      |       |
      |                      int     long long int
      |                     %lld
aliens.cpp:16:25: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long long int' [-Wformat=]
   16 |     printf("examine %d %d\n",x,y);
      |                        ~^      ~
      |                         |      |
      |                         int    long long int
      |                        %lld
At global scope:
cc1plus: error: '::main' must return 'int'
aliens.cpp: In function 'int main()':
aliens.cpp:141:23: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
  141 |     printf("solution %d %d\n",X,Y);
      |                      ~^       ~
      |                       |       |
      |                       int     long long int
      |                      %lld
aliens.cpp:141:26: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long long int' [-Wformat=]
  141 |     printf("solution %d %d\n",X,Y);
      |                         ~^      ~
      |                          |      |
      |                          int    long long int
      |                         %lld
aliens.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |     scanf(" %lld",&N);
      |     ~~~~~^~~~~~~~~~~~
aliens.cpp:29:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |     scanf(" %lld",&X);
      |     ~~~~~^~~~~~~~~~~~
aliens.cpp:30:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     scanf(" %lld",&Y);
      |     ~~~~~^~~~~~~~~~~~