Submission #199778

#TimeUsernameProblemLanguageResultExecution timeMemory
199778MercenaryAliens (IOI07_aliens)C++14
0 / 100
7 ms504 KiB
#include<bits/stdc++.h> #define pb push_back #define mp make_pair #define taskname "A" #define int ll using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> ii; const int maxn = 1e5 + 5; int n , m , x , y; bool q(int i , int j){ if(i <= 0 || i > n || j <= 0 || j > n)return 0; cout << "examine " << i << " " << j << endl; string s;cin >> s; return s[0] == 't'; } int U , D , L , R; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> x >> y; int l , h; l = 1 , h = x; while(l <= h){ int mid = l + h >> 1; if(!q(mid,y))l = mid + 1; else h = mid - 1; } D = l; l = x , h = n; while(l <= h){ int mid = l + h >> 1; if(q(mid,y))l = mid + 1; else h = mid - 1; } U = l; l = 1 , h = y; while(l <= h){ int mid = l + h >> 1; if(!q(x,mid))l = mid + 1; else h = mid - 1; } L = l; l = y , h = n; while(l <= h){ int mid = l + h >> 1; if(q(x,mid))l = mid + 1; else h = mid - 1; } R = l; m = R - L + 1; if(m % 3 == 0 && !q(U+m/3,L+m/3))m /= 3; else if(m % 5 == 0 && !q(U+m/5,L+m/5))m /= 5; x = U + m / 2;y = L + m / 2; int _x = 0 , cntx = 0 , _y = 0 , cnty = 0; for(int i = -2 ; i <= 2 ; ++i){ if(q(i*2*m+x,y)){ cntx++;_x += i*2*m+x; } if(q(x,i*2*m+y)){ cnty++;_y += i*2*m+y; } } cout << "solution " << _x / cntx << " " << _y / cnty; }

Compilation message (stderr)

aliens.cpp: In function 'int32_t main()':
aliens.cpp:30:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int mid = l + h >> 1;
                   ~~^~~
aliens.cpp:37:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int mid = l + h >> 1;
                   ~~^~~
aliens.cpp:44:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int mid = l + h >> 1;
                   ~~^~~
aliens.cpp:51:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int mid = l + h >> 1;
                   ~~^~~
#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...