Submission #248626

#TimeUsernameProblemLanguageResultExecution timeMemory
248626thebesMobile (BOI12_mobile)C++14
100 / 100
948 ms27592 KiB
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,ssse3,sse3,sse4,popcnt,avx,mmx,abm,tune=native") #include <bits/stdc++.h> using namespace std; const int MN = 1e6+6; const long double eps = 1e-4; int N, L, i, j, x, y; pair<int,int> vec[MN]; long double lo, hi, mid, rad, f, s, a, b, cur; int main(){ scanf("%d%d",&N,&L); for(i=1;i<=N;i++){ scanf("%d%d",&x,&y); y = abs(y); vec[i]={x,y}; } lo=0, hi=1e9; while(lo+eps<hi){ mid=(lo+hi)/2; cur = eps; for(i=1;i<=N;i++){ if(mid<vec[i].second) continue; else{ rad = sqrt(mid*mid-(long double)vec[i].second*vec[i].second); a=vec[i].first-rad, b=vec[i].first+rad; } if(b>cur&&a<=cur) cur=b; if(cur>=L) break; } if(cur>=L) hi=mid; else lo=mid+eps; } printf("%.4Lf\n",lo); return 0; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&N,&L);
     ~~~~~^~~~~~~~~~~~~~
mobile.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&x,&y);
         ~~~~~^~~~~~~~~~~~~~
#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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...