Submission #989312

#TimeUsernameProblemLanguageResultExecution timeMemory
989312PedroBigManAliens (IOI07_aliens)C++14
70 / 100
1 ms344 KiB
#pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #pragma GCC optimize("Ofast") #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <queue> #include <deque> #include <list> #include <iomanip> #include <stdlib.h> #include <time.h> #include <cstring> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define whole(x) x.begin(),x.end() #define DEBUG(i) cout<<"Pedro "<<i<<endl #define INF 1000000000000000000LL #define EPS ((ld)0.00000000001) #define pi ((ld)3.141592653589793) #define VV(vvvv,NNNN,xxxx); REP(iiiii,0,NNNN) {vvvv.pb(xxxx);} ll mod=1000000007; template<class A=ll> void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;} template<class A=ll> void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}} ll N, X, Y; ll ask(ll x, ll y) { if(x<0LL || x>=N || y<0LL || y>=N) {return 0LL;} cout<<"examine "<<x+1LL<<" "<<y+1LL<<endl; string ans; cin>>ans; if(ans=="true") {return 1LL;} else {return 0LL;} } void ans(ll x, ll y) { cout<<"solution "<<x+1LL<<" "<<y+1LL<<endl; } ll max_direction(ll dx, ll dy) { ll lo=0LL, hi=N-1LL, mid, thisans; while(lo<hi) { mid=(lo+hi+1LL)/2LL; thisans = ask(X+dx*mid,Y+dy*mid); if(thisans==0) {hi=mid-1LL; continue;} thisans = ask(X+dx*(mid/2LL),Y+dy*(mid/2LL)); if(thisans==0) {hi=mid/2LL -1LL;} else {lo=mid;} } return lo; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(20); cin>>N>>X>>Y; X--; Y--; ll up = max_direction(-1LL,0LL); ll down = max_direction(1LL,0LL); ll left = max_direction(0LL,-1LL); ll right = max_direction(0LL,1LL); ll M = left+right+1LL; if(M!=up+down+1LL) {return 0;} X+=(down-up)/2LL; Y+=(right-left)/2LL; ll numdown, numright, numleft, numup; REP(i,1,4) {if(ask(X+2LL*M*i,Y)==0) {numdown=i-1; break;}} REP(i,1,4) {if(ask(X-2LL*M*i,Y)==0) {numup=i-1; break;}} REP(i,1,4) {if(ask(X,Y+2LL*M*i)==0) {numright=i-1; break;}} REP(i,1,4) {if(ask(X,Y-2LL*M*i)==0) {numleft=i-1; break;}} if((numdown+numup)==2LL) {X+=(2LL*M*(numdown-1LL));} else {X+=(M*(2LL*numdown-1LL));} if((numleft+numright)==2LL) {Y+=(2LL*M*(numright-1LL));} else {Y+=(M*(2LL*numright-1LL));} ans(X,Y); return 0; }

Compilation message (stderr)

aliens.cpp:1: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    1 | #pragma GCC optimization ("O3")
      | 
aliens.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization ("unroll-loops")
      | 
aliens.cpp: In function 'int main()':
aliens.cpp:89:16: warning: 'numleft' may be used uninitialized in this function [-Wmaybe-uninitialized]
   89 |     if((numleft+numright)==2LL) {Y+=(2LL*M*(numright-1LL));} else {Y+=(M*(2LL*numright-1LL));}
      |        ~~~~~~~~^~~~~~~~~~
aliens.cpp:89:78: warning: 'numright' may be used uninitialized in this function [-Wmaybe-uninitialized]
   89 |     if((numleft+numright)==2LL) {Y+=(2LL*M*(numright-1LL));} else {Y+=(M*(2LL*numright-1LL));}
      |                                                                           ~~~^~~~~~~~~
aliens.cpp:88:16: warning: 'numup' may be used uninitialized in this function [-Wmaybe-uninitialized]
   88 |     if((numdown+numup)==2LL) {X+=(2LL*M*(numdown-1LL));} else {X+=(M*(2LL*numdown-1LL));}
      |        ~~~~~~~~^~~~~~~
aliens.cpp:88:74: warning: 'numdown' may be used uninitialized in this function [-Wmaybe-uninitialized]
   88 |     if((numdown+numup)==2LL) {X+=(2LL*M*(numdown-1LL));} else {X+=(M*(2LL*numdown-1LL));}
      |                                                                       ~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...