Submission #198682

#TimeUsernameProblemLanguageResultExecution timeMemory
198682sjimedAliens (IOI07_aliens)C++14
0 / 100
9 ms524 KiB
#include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false);cin.tie(NULL) #define fi first #define se second #define all(v) (v).begin(),(v).end() #define pb push_back #define eb emplace_back #define pre(a) cout<<fixed; cout.precision(a) #define mp make_pair typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const long long INF = 1e18; const int inf = 1e9; int n, M; ll x, y; pll s, e; pll ans; bool ask(ll i, ll j) { cout << "examine " << i << " " << j << endl; string s; cin >> s; return s == "true"; } bool q(ll i, ll j) { if(!ask(i, j)) return false; i = i + x >> 1; j = j + y >> 1; if(!ask(i, j)) return false; i = i + x >> 1; j = j + y >> 1; if(!ask(i, j)) return false; return true; } int main() { cin >> n >> x >> y; ll l = x, r = n; while(l != r) { ll m = l + r + 1 >> 1; if(q(m, y)) l = m; else r = m-1; } e.fi = l; l = 1, r = x; while(l != r) { ll m = l + r >> 1; if(q(m, y)) r = m; else l = m+1; } s.fi = l; l = y, r = n; while(l != r) { ll m = l + r + 1 >> 1; if(q(x, m)) l = m; else r = m-1; } e.se = l; l = 1, r = y; while(l != r) { ll m = l + r >> 1; if(q(x, m)) r = m; else l = m+1; } s.se = l; x = s.fi + e.fi >> 1; y = s.se + e.se >> 1; M = e.se - s.se + 1; cout << x << " " << y << endl; ll cnt = 0; for(ll i = x - 4*M; i<=x + 4*M; i += 2*M) { if(i < 1 || i > n) continue; if(ask(i, y)) cnt++, ans.fi += i; } ans.fi /= cnt; cnt = 0; for(ll i = y - 4*M; i<=y + 4*M; i += 2*M) { if(i < 1 || i > n) continue; if(ask(x, i)) cnt++, ans.se += i; } ans.se /= cnt; cout << "solution " << ans.fi << " " << ans.se << endl; }

Compilation message (stderr)

aliens.cpp: In function 'bool q(ll, ll)':
aliens.cpp:35:8: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  i = i + x >> 1;
      ~~^~~
aliens.cpp:36:8: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  j = j + y >> 1;
      ~~^~~
aliens.cpp:38:8: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  i = i + x >> 1;
      ~~^~~
aliens.cpp:39:8: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  j = j + y >> 1;
      ~~^~~
aliens.cpp: In function 'int main()':
aliens.cpp:51:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   ll m = l + r + 1 >> 1;
          ~~~~~~^~~
aliens.cpp:62:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   ll m = l + r >> 1;
          ~~^~~
aliens.cpp:73:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   ll m = l + r + 1 >> 1;
          ~~~~~~^~~
aliens.cpp:84:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   ll m = l + r >> 1;
          ~~^~~
aliens.cpp:92:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  x = s.fi + e.fi >> 1;
           ^
aliens.cpp:93:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  y = s.se + e.se >> 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...