Submission #1190413

#TimeUsernameProblemLanguageResultExecution timeMemory
1190413amm_ouxAliens (IOI07_aliens)C++20
30 / 100
1 ms412 KiB
#include<bits/stdc++.h> using namespace std ; using ll = long long ; #define vll vector<ll> #define vvll vector<vll> ll Pow[33] ; void powsof2 (){ ll p = 1 ; Pow[0] = 0 ; Pow[1] = 1 ; for (int i = 2 ; i < 33 ; i++){ p*=2 ; Pow[i] = p ; } } void solve (){ powsof2() ; ll N ,X , Y , M; ll Xd = -1 ; ll Xg = -1 ; ll Yu = -1 ; ll Xf , Yf , Xpr , Ypr; int j = 1 ; cin >> N >> X >> Y ; bool response = 1; string res ; for (int i = 0 ; i < 10 ; i++){ cout << "examine " << X << " " << Y << flush << endl ; cin >> res ; } while (response && X+Pow[j] < N +1 ){ cout << "examine " << X+Pow[j] << " " << Y << flush << endl ; cin >> res ; if (res == "true") {response = 1 ; j++ ; } else {response = 0 ;} } if (X+Pow[j] > N ) { if (j == 1) {Xd = N ; } else { cout << "examine " << N << " " << Y << flush << 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 - Xpr)/2 ; cout << "examine " << mid << " " << Y << flush << endl ; cin >> res ; if (res == "true") { Xpr = mid ; } else {Xf = mid ;} } if (Xd < 0) Xd = Xpr ; response = 1 ; j = 1 ; while (response && X-Pow[j] > 0 ){ cout << "examine " << X-Pow[j] << " " << Y << flush << endl ; cin >> res ; if (res == "true") {response = 1 ; j++ ; } else {response = 0 ;} } if (X-Pow[j] < 1) { if (j == 1) {Xg = 1 ; } else { cout << "examine " << 1 << " " << Y << flush << endl ; cin >> res ; if (res == "true") {Xg = 1 ;} } } Xpr = X-Pow[j-1] ; Xf = max (N-N+1 , X-Pow[j] ) ; while (Xg < 0 && Xpr - Xf > 1) { ll mid = Xpr - (Xpr - Xf)/2 ; cout << "examine " << mid << " " << Y << flush << endl ; cin >> res ; if (res == "true") { Xpr = mid ; } else {Xf = mid ;} } if (Xg < 0) Xg = Xpr ; M = Xd - Xg + 1 ; response = 1 ; j = 1 ; while (response && Y+Pow[j] < N+1 ){ cout << "examine " << X<< " " << Y+Pow[j] << flush << endl ; cin >> res ; if (res == "true") {response = 1 ; j++ ; } else {response = 0 ;} } if (Y+Pow[j] > N) { if (j == 1) Yu = N ; else { cout << "examine " << X << " " << N << flush << 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 << flush << endl ; cin >> res ; if (res == "true") { Ypr = mid ; } else {Yf = mid ;} } if (Yu < 0) 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 << flush << endl; } int main (){ ll t = 1 ; //ios :: sync_with_stdio(false) ; cin.tie(0); while (t--) solve(); }
#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...