Submission #1188763

#TimeUsernameProblemLanguageResultExecution timeMemory
1188763flukeAliens (IOI07_aliens)C++20
0 / 100
2 ms476 KiB
#include <bits/stdc++.h> #define ll long long #define f first #define s second #define pii pair<int,int> #define emb emplace_back #define em emplace #define DB cout<<"\n";system("pause"); #define all(x) x.begin(),x.end() #define sp <<" "<< using namespace std; bool in(ll x , ll y){ cout<<"examine "<<x<<" "<<y<<endl; bool ans; cin>>ans; return ans; } void out(ll x , ll y){ cout<<"solution "<<x<<" "<<y<<endl; } int main(){ int sti ,stj; cin >> sti >> stj; ll inow = sti , jnow = stj; ll jump = 1; ll left = stj , right ; // -> while(1){ jnow += jump; jump*=2; if(in(inow , jnow)){ left = jnow; } else { right = jnow; break; } } ll right_edge; while(left <= right){ ll mid = (left + right)/2; if(in(sti , mid)){ right_edge = mid; left = mid + 1; } else { right = mid - 1; } } // cout<<"right_edge : " sp sti sp right_edge << "\n"; // <= inow = sti; jnow = stj; jump = 1; right = stj; while(1){ jnow -= jump; jump*=2; if(in(inow , jnow)){ right = jnow; } else { left = jnow; break; } } ll left_edge; while(left <= right){ ll mid = (left + right)/2; if(in(sti , mid)){ left_edge = mid ; right = mid - 1; } else { left = mid + 1; } } // cout<<"left_edge : " sp sti sp left_edge<<"\n"; // ^ // | inow = sti; jnow = stj; jump = 1; left = sti; while(1){ inow += jump; jump*=2; if(in(inow , jnow)){ left = inow; } else { right = inow; break; } } ll top_edge ; while(left <= right){ ll mid = (left + right) / 2; if(in(mid ,stj)){ top_edge = mid; left = mid + 1; } else { right = mid - 1; } } // cout<<"top_edge : " sp top_edge sp stj; ll m = right_edge - left_edge + 1; ll bottom_edge = top_edge - m + 1; // cout<<"all \n"; // cout<<"right_edge : " sp sti sp right_edge << "\n"; // cout<<"left_edge : " sp sti sp left_edge<<"\n"; // cout<<"top_edge : " sp top_edge sp stj<<"\n"; // cout<<"bottom_edge : " sp bottom_edge sp stj<<"\n"; ll cj = (right_edge + left_edge)/2; ll ci = (top_edge + bottom_edge)/2; // cout<<ci sp cj ; ll nexti ; ll nextj ; bool can_walk = true; while(can_walk){ can_walk = false; nexti = ci; nextj = cj; nextj += 2*m; if(in(nexti,nextj)){ cj += 2*m; can_walk = true; } nexti = ci; nextj = cj; nexti += 2*m; if(in(nexti , nextj)){ ci += 2*m; can_walk = true; } nexti = ci; nextj = cj; nexti += m; nextj += m; if(in(nexti,nextj)){ ci += m; cj += m; can_walk = true; } } ci -= 2*m; cj -= 2*m; out(ci,cj); }
#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...