Submission #468769

# Submission time Handle Problem Language Result Execution time Memory
468769 2021-08-29T14:40:34 Z DDTerziev04 Mobile (BOI12_mobile) C++14
0 / 100
958 ms 15964 KB
#include<iostream>
#include<cmath>
using namespace std;

const int MAXN=1e6;
const double MAXL=1e10;

pair<long long, long long> pts[MAXN];

bool CanCover(int n, int m, double l)
{
   //cout << l << "\n";
   double d=0;
   for(int i=0; i<n; i++)
   {
      double x=sqrt(l*l-pts[i].second*pts[i].second);
      if(pts[i].first-x<=d)
      {
         d=pts[i].first+x;
      }
   }
   //cout << d << "===========\n";

   return d>=m;
}

int main()
{
   //ios_base::sync_with_stdio(0);
   //cin.tie(0);

   int n, m;
   cin >> n >> m;

   for(int i=0; i<n; i++)
   {
      cin >> pts[i].first >> pts[i].second;
   }

   double diff=0.001, l=0, r=MAXL, ans;
   while(r-l>=diff)
   {
      double mid=l+(r-l)/2;
      if(CanCover(n, m, mid))
      {
         ans=mid;
         r=mid;
      }
      else
      {
         l=mid;
      }
   }

   cout << ans << "\n";

   return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Incorrect 2 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 332 KB Output is correct
2 Incorrect 5 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 1384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 1476 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 62 ms 1568 KB Output is correct
2 Incorrect 72 ms 1512 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 102 ms 1836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 94 ms 1764 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 369 ms 8104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 512 ms 8072 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 427 ms 9664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 592 ms 9776 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 519 ms 11240 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 696 ms 11232 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 570 ms 12684 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 757 ms 12836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 725 ms 15956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 958 ms 15964 KB Output isn't correct
2 Halted 0 ms 0 KB -