Submission #112589

#TimeUsernameProblemLanguageResultExecution timeMemory
112589zoooma13Mobile (BOI12_mobile)C++14
0 / 100
1082 ms10744 KiB
#include <bits/stdc++.h> using namespace std; #define MAX_N 1000006 int n ,l; int x[MAX_N] ,y[MAX_N]; bool can(double X) { double mx = 0; for(int i=0; i<n; i++){ if(y[i]-X > 1e-6) continue; double len = sqrt((X*X)-(1.0*y[i]*y[i])); if(x[i]-len-mx > 1e-6) return 0; mx = max(mx ,x[i]+len); } return (mx >= l); } int main() { scanf("%d%d",&n,&l); for(int lx=-2e9 ,i=0; i<n; i++) { scanf("%d%d",&x[i],&y[i]) ,y[i] = abs(y[i]); if(lx == x[i]){ y[i-1] = min(y[i-1] ,y[i]); i-- ,n--; }lx = x[i]; } double st = 0 ,en = 1e18 ,mid; for(int ee=200; ee; ee--){ mid = (st+en)/2; if(can(mid)) en = mid; else st = mid; } cout << fixed << setprecision(6) << en << endl; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:25: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:28:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&x[i],&y[i]) ,y[i] = abs(y[i]);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#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...