Submission #896013

#TimeUsernameProblemLanguageResultExecution timeMemory
896013AndreyAliens (IOI07_aliens)C++14
0 / 100
1 ms704 KiB
#include<bits/stdc++.h> using namespace std; long long n; bool query(long long x, long long y) { if(x < 1 || x > n || y < 1 || y > n) { return false; } string s; cout << "examine " << x << " " << y << endl; cin >> s; if(s == "false") { cout << 1/0 << endl; return false; } else { return true; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long x,y; cin >> n >> x >> y; long long r = x,c,l = x,u = y; for(long long i = 0; i < 31; i++) { c = i; if(!query(r+(1LL << i),y)) { break; } } for(long long i = c; i >= 0; i--) { if(query(r+(1LL << i),y)) { r+=(1LL << i); } } c = 0; for(long long i = 0; i < 31; i++) { c = i; if(!query(l-(1LL << i),y)) { break; } } for(long long i = c; i >= 0; i--) { if(query(l-(1LL << i),y)) { l-=(1LL << i); } } long long m = r-l+1; c = 0; for(long long i = 0; i < 31; i++) { c = i; if(!query(x,u+(1LL << i))) { break; } } for(long long i = c; i >= 0; i--) { if(query(x,u+(1LL << i))) { u+=(1LL << i); } } long long d = u-m+1; x = (l+r)/2,y = (u+d)/2; long long sb1 = 0,sb2 = 0; for(long long i = -5; i <= 5; i++) { for(long long j = -5; j <= 5; j++) { if(query(x+i*m,y+j*m)) { sb1+=x+i*m; sb2+=y+i*m; } } } cout << "solution " << sb1/13 << " " << sb2/13 << endl; return 0; }

Compilation message (stderr)

aliens.cpp: In function 'bool query(long long int, long long int)':
aliens.cpp:14:18: warning: division by zero [-Wdiv-by-zero]
   14 |         cout << 1/0 << endl;
      |                 ~^~
#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...