Submission #1190175

#TimeUsernameProblemLanguageResultExecution timeMemory
1190175amm_ouxAliens (IOI07_aliens)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>

using namespace std ;

using ll = long long ;

#define vll vector<ll>

#define vvll vector<vll>

ll pow[30] ;

void powsof2 (){
    ll p = 1 ;
    pow[0] = 0 ;
    pow[1] = 1 ;
    
    for (int i = 2 ; i < 30 ; i++){
        p*=2 ;
        pow[i] = p ;
    }
}



void solve (){
      
    ll N ,X , Y ;
    int j = 1 ;
    
    cin >> N >> X >> Y ;
    
    bool response = 1;
    
    string res ;
    
    while (response && X+pow[j] < N +1 ){
        cout <<  "examine " << X+pow[j] << " " << Y << endl ;
        cin >> res ;
        if (res == "true") {response = 1 ;  j++ ; }
        else {response = 0 ;}
     }
     
     if (X+pow[j] < N +1) {
        cout <<  "examine " << N << " " << Y << endl ; cin >> res ;
        if (res == "true") {Xd = N ; }
     } Xpr = X+pow[j-1] ; Xf = min (N , X+pow[j] ) ;
     
     
     
     
     while (Xd < 0 && Xf - Xpr > 1) {
        ll mid = Xpr + (Xf - Xprev)/2 ;
        cout <<  "examine " << mid << " " << Y << endl ;
        cin >> res ;
        if (res == "true") {  Xpr = mid ; }
        else {Xf = mid ;}
     } Xd = Xpr ;
     
     
     
     
     
     response = 1 ; j = 1 ;
     while (response && X-pow[j] > 0 ){
        cout <<  "examine " << X-pow[j] << " " << Y << endl ;
        cin >> res ;
        if (res == "true") {response = 1 ;  j++ ; }
        else {response = 0 ;}
     }
     
     if (X-pow[j] < 1) {
        cout <<  "examine " << 1 << " " << Y << endl ; cin >> res ;
        if (res == "true") {Xg = 1 ; }
     } Xpr = X-pow[j-1] ; Xf = max (1 , X-pow[j] ) ;
     
    
     while (Xg < 0 && Xpr - Xf > 1) {
        ll mid = Xpr - (Xpr - Xf)/2 ;
        cout <<  "examine " << mid << " " << Y << endl ;
        cin >> res ;
        if (res == "true") {  Xpr = mid ; }
        else {Xf = mid ;}
     } Xg = Xpr ;
     
     
     M = Xd - Xg ;
     
     
     
     
     
     
     response = 1 ; j = 1 ;
     while (response && Y+pow[j] < N+1 ){
        cout <<  "examine " << X<< " " << Y+pow[j] << endl ;
        cin >> res ;
        if (res == "true") {response = 1 ;  j++ ; }
        else {response = 0 ;}
     }
     
     if (Y+pow[j] > N) {
        cout <<  "examine " << X << " " << N << endl ; cin >> res ;
        if (res == "true") {Yu = N ; }
     } Ypr = Y+pow[j-1] ; Yf = min (Y+pow[j] , N ) ;
     
    
     while (Yu < 0 && Yf - Ypr > 1) {
        ll mid = Ypr + (Yf - Ypr)/2 ;
        cout <<  "examine " << X << " " << mid << endl ;
        cin >> res ;
        if (res == "true") {  Ypr = mid ; }
        else {Yf = mid ;}
     } Yu = Ypr ;
     
     
     int sypos = 5 ; 
     int sxpos = 5 ; 
     
     
     
     for (int i = 0 ; i < 4 ; i++) {
        if (Xd + (4-i)*M > N ) continue ;
        else {
            cout <<  "examine " << Xd + (4-i)*M << " " << Y << endl ; cin >> res ;
            if (res == "true") {  sxpos = i+1 ; break ;}
        }
     }
     
     for (int i = 0 ; i < 4 ; i++) {
        if (Yu + (4-i)*M > N ) continue ;
        else {
            cout <<  "examine " << X << " " << Yu + (4-i)*M << endl ; cin >> res ;
            if (res == "true") {  sypos = i+1 ; break ;}
        }
     }
     
     cout << "solution " << Xd + (3-sxpos)*M - M/2 << " " << Yu + (3-sypos)*M - M/2 << endl;
     
     
     
    
}


int main (){
    ll t = 1 ;
    //ios :: sync_with_stdio(false) ; cin.tie(0);
    while (t--)
        solve();
}

Compilation message (stderr)

aliens.cpp:11:10: error: 'll pow [30]' redeclared as different kind of entity
   11 | ll pow[30] ;
      |          ^
In file included from /usr/include/features.h:486,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:586,
                 from /usr/include/c++/11/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33,
                 from aliens.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:140:1: note: previous declaration 'double pow(double, double)'
  140 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~~~~~
aliens.cpp: In function 'void powsof2()':
aliens.cpp:15:8: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |     pow[0] = 0 ;
      |        ^
aliens.cpp:16:8: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   16 |     pow[1] = 1 ;
      |        ^
aliens.cpp:20:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |         pow[i] = p ;
      |            ^
aliens.cpp: In function 'void solve()':
aliens.cpp:37:29: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   37 |     while (response && X+pow[j] < N +1 ){
      |                             ^
aliens.cpp:38:37: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   38 |         cout <<  "examine " << X+pow[j] << " " << Y << endl ;
      |                                     ^
aliens.cpp:44:15: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   44 |      if (X+pow[j] < N +1) {
      |               ^
aliens.cpp:46:29: error: 'Xd' was not declared in this scope; did you mean 'X'?
   46 |         if (res == "true") {Xd = N ; }
      |                             ^~
      |                             X
aliens.cpp:47:8: error: 'Xpr' was not declared in this scope
   47 |      } Xpr = X+pow[j-1] ; Xf = min (N , X+pow[j] ) ;
      |        ^~~
aliens.cpp:47:19: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   47 |      } Xpr = X+pow[j-1] ; Xf = min (N , X+pow[j] ) ;
      |                   ^
aliens.cpp:47:27: error: 'Xf' was not declared in this scope; did you mean 'X'?
   47 |      } Xpr = X+pow[j-1] ; Xf = min (N , X+pow[j] ) ;
      |                           ^~
      |                           X
aliens.cpp:47:46: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   47 |      } Xpr = X+pow[j-1] ; Xf = min (N , X+pow[j] ) ;
      |                                              ^
aliens.cpp:52:13: error: 'Xd' was not declared in this scope; did you mean 'X'?
   52 |      while (Xd < 0 && Xf - Xpr > 1) {
      |             ^~
      |             X
aliens.cpp:53:30: error: 'Xprev' was not declared in this scope
   53 |         ll mid = Xpr + (Xf - Xprev)/2 ;
      |                              ^~~~~
aliens.cpp:58:8: error: 'Xd' was not declared in this scope; did you mean 'X'?
   58 |      } Xd = Xpr ;
      |        ^~
      |        X
aliens.cpp:65:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   65 |      while (response && X-pow[j] > 0 ){
      |                              ^
aliens.cpp:66:37: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   66 |         cout <<  "examine " << X-pow[j] << " " << Y << endl ;
      |                                     ^
aliens.cpp:72:15: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   72 |      if (X-pow[j] < 1) {
      |               ^
aliens.cpp:74:29: error: 'Xg' was not declared in this scope; did you mean 'X'?
   74 |         if (res == "true") {Xg = 1 ; }
      |                             ^~
      |                             X
aliens.cpp:75:19: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   75 |      } Xpr = X-pow[j-1] ; Xf = max (1 , X-pow[j] ) ;
      |                   ^
aliens.cpp:75:46: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   75 |      } Xpr = X-pow[j-1] ; Xf = max (1 , X-pow[j] ) ;
      |                                              ^
aliens.cpp:78:13: error: 'Xg' was not declared in this scope; did you mean 'X'?
   78 |      while (Xg < 0 && Xpr - Xf > 1) {
      |             ^~
      |             X
aliens.cpp:84:8: error: 'Xg' was not declared in this scope; did you mean 'X'?
   84 |      } Xg = Xpr ;
      |        ^~
      |        X
aliens.cpp:87:6: error: 'M' was not declared in this scope
   87 |      M = Xd - Xg ;
      |      ^
aliens.cpp:95:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   95 |      while (response && Y+pow[j] < N+1 ){
      |                              ^
aliens.cpp:96:48: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   96 |         cout <<  "examine " << X<< " " << Y+pow[j] << endl ;
      |                                                ^
aliens.cpp:102:15: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
  102 |      if (Y+pow[j] > N) {
      |               ^
aliens.cpp:104:29: error: 'Yu' was not declared in this scope; did you mean 'Y'?
  104 |         if (res == "true") {Yu = N ; }
      |                             ^~
      |                             Y
aliens.cpp:105:8: error: 'Ypr' was not declared in this scope
  105 |      } Ypr = Y+pow[j-1] ; Yf = min (Y+pow[j] , N ) ;
      |        ^~~
aliens.cpp:105:19: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
  105 |      } Ypr = Y+pow[j-1] ; Yf = min (Y+pow[j] , N ) ;
      |                   ^
aliens.cpp:105:27: error: 'Yf' was not declared in this scope; did you mean 'Y'?
  105 |      } Ypr = Y+pow[j-1] ; Yf = min (Y+pow[j] , N ) ;
      |                           ^~
      |                           Y
aliens.cpp:105:42: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
  105 |      } Ypr = Y+pow[j-1] ; Yf = min (Y+pow[j] , N ) ;
      |                                          ^
aliens.cpp:108:13: error: 'Yu' was not declared in this scope; did you mean 'Y'?
  108 |      while (Yu < 0 && Yf - Ypr > 1) {
      |             ^~
      |             Y
aliens.cpp:114:8: error: 'Yu' was not declared in this scope; did you mean 'Y'?
  114 |      } Yu = Ypr ;
      |        ^~
      |        Y