제출 #388971

#제출 시각아이디문제언어결과실행 시간메모리
388971tostesMobile (BOI12_mobile)C++17
100 / 100
679 ms35396 KiB
#include<bits/stdc++.h> //#include<iostream> //#include<vector> using namespace std; #define _ << ' ' << #define pb push_back #define all(x) begin(x), end(x) #define mp make_pair #define f first #define s second #define sz(x) int((x).size()) using ll = long long; using db = long double; using pl = pair<ll,ll>; using pi = pair<int,int>; vector < pair<double,double> > pt; int n; double l; bool pos(double k){ double sm=0; for(int i=0; i<n; i++){ if(abs(pt[i].s)>=k) continue; double sq = sqrt(k*k-pt[i].s*pt[i].s); if(pt[i].f-sq<=sm) sm=max(sm,pt[i].f+sq); } return sm>=l; } int main(){ // ios::sync_with_stdio(false); // cin.tie(0); //freopen("loan.in", "r", stdin); //freopen("loan.out", "w", stdout); scanf("%d %lf", &n, &l); pt.resize(n); for(auto &x: pt) scanf("%lf %lf", &x.f, &x.s); double lo=0, hi=1e10; while((hi-lo)>0.00001){ double mid=(lo+hi)/2; if(pos(mid)) hi=mid; else lo=mid; } printf("%.6lf\n", lo); }

컴파일 시 표준 에러 (stderr) 메시지

mobile.cpp: In function 'int main()':
mobile.cpp:36:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   36 |  scanf("%d %lf", &n, &l);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
mobile.cpp:38:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   38 |  for(auto &x: pt) scanf("%lf %lf", &x.f, &x.s);
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#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...