Submission #1051669

#TimeUsernameProblemLanguageResultExecution timeMemory
1051669Dennis_JasonAliens (IOI07_aliens)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define NMAX 200001 #define int long long #define pb push_back #define eb emplace_back #define MOD 1000000007 #define nl '\n' #define INF 1000000007 #define LLONG_MAX 9223372036854775807 #define pii pair<int,int> #define tpl tuple<int,int,int,int> #pragma GCC optimize("O3") using namespace std; ifstream fin("aib.in"); ofstream fout("aib.out"); /* * * ----------------DEMONSTRATION------------------- Steps: 1.Find Xright in given red cell =>M=xr-xl 2.find Xleft in given red cell 3.Find Ydown in given red cell => Yup=Ydown+m 4.find cell_up,cell_right,cell_down,cell_left 5.print Xc,Yc :) BIG FAIL :(((( ---------------------END------------------------ */ /*-------------Initialize------------*/ int n,x,y; int Xr,Xl,Yu,Yd,Xc,Yc; int Wl,Wr,Wd; int m; int Cl,Cr,Cd,Cu; int mid_x,mid_y; void find_Wl() { int red=1; int cur=x; int k=0; while(red==1) { cur=x-(1LL << k); if(cur<0) cur=0; Wl=cur; k++; cout.flush()<<"examine "<<cur<<" "<<y<<nl; cout.flush(); string word; cin>>word; if(word=="false") red=0; else red=1; if(red==0) break; } Wl=max(0,Wl); } void find_Wr() { int red=1; int cur=x; int k=0; while(red==1) { cur=x+(1LL << k); if(cur>n) cur=n; Wr=cur; k++; cout.flush()<<"examine "<<cur<<" "<<y<<nl; cout.flush(); string word; cin>>word; if(word=="false") red=0; else red=1; if(red==0) break; } Wr=min(n,Wr); } void find_Xl() { int st=Wl; int dr=Wr; while(st<=dr) { int mid=(st+dr)/2; cout.flush()<<"examine "<<mid<<" "<<y<<nl; cout.flush(); string word; cin>>word; int red; if(word=="false") red=0; else red=1; if(red) { dr=mid-1; Xl=mid; } else st=mid+1; } } void find_Xr() { int st=Wl; int dr=Wr; while(st<=dr) { int mid=(st+dr)/2; cout.flush()<<"examine "<<mid<<" "<<y<<nl; cout.flush(); string word; int red; cin>>word; if(word=="false") red=0; else red=1; if(red) { st=mid+1; Xr=mid; } else dr=mid-1; } } void calc_m() { m=(Xr-Xl+1); } void find_cell_mid() { int up=0,down=0; //up int st=y; int dr=y+m+1; while(st<=dr) { int mid=(st+dr)/2; cout.flush()<<"examine "<<x<<" "<<mid<<nl; cout.flush(); string word; int red; cin>>word; if(word=="false") red=0; else red=1; if(red) { up=mid; st=mid+1; } else dr=mid-1; } // down st=y-(m+1); dr=y; while(st<=dr) { int mid=(st+dr)/2; cout.flush()<<"examine "<<x<<" "<<mid<<nl; cout.flush(); string word; int red; cin>>word; if(word=="false") red=0; else red=1; if(red) { down=mid; dr=mid-1; } else st=mid+1; } mid_x=(Xl+Xr)/2; mid_y=(up+down)/2; } void left_up() { int red=1; int cur_x=mid_x; int cur_y=mid_y; while(red) { cur_x-=m; cur_y+=m; cout.flush()<<"examine "<<cur_x<<" "<<cur_y<<nl; cout.flush(); string word; red; cin>>word; if(word=="false") red=0; else red=1; if(red==0) break; mid_x=cur_x; mid_y=cur_y; } } void left() { int red=1; int cur=mid_x; while(red) { cur-=2*m; cout.flush()<<"examine "<<cur<<" "<<mid_y<<nl; cout.flush(); string word; int red; cin>>word; if(word=="false") red=0; else red=1; if(red==0) break; mid_x=cur; } } void up() { int red=1; int cur=mid_y; while(red) { cur+=2*m; cout.flush()<<"examine "<<mid_x<<" "<<cur<<nl; cout.flush(); string word; int red; cin>>word; if(word=="false") red=0; else red=1; if(red==0) break; mid_y=cur; } } void find_solution() { Xc=mid_x+2*m; Yc=mid_y-2*m; } void print_solution() { cout.flush()<<"solution "<<Xc<<" "<<Yc<<nl; cout.flush(); } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>n>>x>>y; find_Wl(); find_Wr(); find_Xl(); find_Xr(); calc_m(); find_cell_mid(); left_up(); left(); up(); find_solution(); print_solution(); return 0; }

Compilation message (stderr)

aliens.cpp:9: warning: "LLONG_MAX" redefined
    9 | #define LLONG_MAX 9223372036854775807
      | 
In file included from /usr/lib/gcc/x86_64-linux-gnu/10/include/limits.h:195,
                 from /usr/lib/gcc/x86_64-linux-gnu/10/include/syslimits.h:7,
                 from /usr/lib/gcc/x86_64-linux-gnu/10/include/limits.h:34,
                 from /usr/include/c++/10/climits:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:39,
                 from aliens.cpp:1:
/usr/include/limits.h:135: note: this is the location of the previous definition
  135 | #  define LLONG_MAX __LONG_LONG_MAX__
      | 
aliens.cpp: In function 'void find_Wl()':
aliens.cpp:71:16: error: no matching function for call to 'max(int, long long int&)'
   71 |     Wl=max(0,Wl);
      |                ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
aliens.cpp:71:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   71 |     Wl=max(0,Wl);
      |                ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
aliens.cpp:71:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   71 |     Wl=max(0,Wl);
      |                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
aliens.cpp:71:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   71 |     Wl=max(0,Wl);
      |                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from aliens.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
aliens.cpp:71:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   71 |     Wl=max(0,Wl);
      |                ^
aliens.cpp: In function 'void left_up()':
aliens.cpp:219:9: warning: statement has no effect [-Wunused-value]
  219 |         red;
      |         ^~~