Submission #1016956

#TimeUsernameProblemLanguageResultExecution timeMemory
1016956Nika533Aliens (IOI07_aliens)C++17
0 / 100
2 ms344 KiB
#pragma GCC diagnostic warning "-std=c++11" #include <bits/stdc++.h> #define int long long #define pb push_back #define f first #define s second #define MOD 1000000007 #define flush fflush(stdout) #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(), (x).rend() #define pii pair<int,int> using namespace std; int n,m,T,k,x,y; int ask(int x, int y) { if (x<1 || x>m || y<1 || y>m) return 0; cout<<"examine "<<x<<" "<<y<<endl; string s; cin>>s; return (s=="true"); } void test_case() { cin>>m>>x>>y; int l=0,r=m-x,xmax; while (l<=r) { int mid=(l+r)/2; int q1=ask(x+mid,y),q2=ask(x+mid/2,y),q3=ask(x+mid/4,y); if (q1 && q2 && q3) { xmax=x+mid; l=mid+1; } else { r=mid-1; } } x=xmax; l=0; r=x-1; int xmin; while (l<=r) { int mid=(l+r)/2; int q1=ask(x-mid,y),q2=ask(x-mid/2,y),q3=ask(x-mid/4,y); if (q1 && q2 && q3) { xmin=x-mid; l=mid+1; } else { r=mid-1; } } n=xmax-xmin+1; l=0; r=m-y; int ymax; while (l<=r) { int mid=(l+r)/2; int q1=ask(x,y+mid),q2=ask(x,y+mid/2),q3=ask(x,y+mid/4); if (q1 && q2 && q3) { ymax=y+mid; l=mid+1; } else { r=mid-1; } } // cout<<xmax<<" "<<ymax<<endl; int mnx=3,mny=3; for (int i=-2; i<=0; i++) { int xx=xmax+n*i,yy=ymax; int q=ask(xx,yy); if (q) { mnx=min(mnx,i); } } for (int i=-2; i<=0; i++) { int xx=xmax,yy=ymax+n*i; int q=ask(xx,yy); if (q) { mny=min(mny,i); } } int i1=mnx+2,i2=mny+2; int x2=xmax+n*i1,y2=ymax+n*i2; int half=n/2; cout<<"solution "<<x2-half<<" "<<y2-half<<endl; } main () { ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0); T=1; while (T--) test_case(); }

Compilation message (stderr)

aliens.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
    1 | #pragma GCC diagnostic warning "-std=c++11"
      |                                ^~~~~~~~~~~~
aliens.cpp:80:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   80 | main () {
      | ^~~~
aliens.cpp: In function 'void test_case()':
aliens.cpp:63:12: warning: 'ymax' may be used uninitialized in this function [-Wmaybe-uninitialized]
   63 |   int q=ask(xx,yy);
      |         ~~~^~~~~~~
aliens.cpp:47:8: warning: 'xmin' may be used uninitialized in this function [-Wmaybe-uninitialized]
   47 |  n=xmax-xmin+1;
      |    ~~~~^~~~~
aliens.cpp:47:8: warning: 'xmax' may be used uninitialized in this function [-Wmaybe-uninitialized]
#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...