Submission #468774

# Submission time Handle Problem Language Result Execution time Memory
468774 2021-08-29T14:56:48 Z DDTerziev04 Mobile (BOI12_mobile) C++14
90 / 100
547 ms 35208 KB
#include<iostream>
#include<cmath>
#include<iomanip>
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)
{
   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 && pts[i].first+x>=d)
      {
         d=pts[i].first+x;
      }
   }

   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 << fixed << setprecision(3) << ans << "\n";

   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
# 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 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 3 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 460 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1484 KB Output is correct
2 Correct 32 ms 1432 KB Output is correct
3 Correct 23 ms 1780 KB Output is correct
4 Correct 39 ms 2600 KB Output is correct
5 Correct 23 ms 1592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 1484 KB Output is correct
2 Correct 33 ms 1404 KB Output is correct
3 Correct 39 ms 1484 KB Output is correct
4 Correct 40 ms 2740 KB Output is correct
5 Correct 45 ms 3096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 1612 KB Output is correct
2 Correct 37 ms 1528 KB Output is correct
3 Correct 37 ms 2548 KB Output is correct
4 Correct 54 ms 3776 KB Output is correct
5 Correct 43 ms 2508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 1868 KB Output is correct
2 Correct 44 ms 3276 KB Output is correct
3 Correct 42 ms 2896 KB Output is correct
4 Correct 55 ms 3784 KB Output is correct
5 Correct 49 ms 3100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 1936 KB Output is correct
2 Correct 44 ms 3272 KB Output is correct
3 Correct 44 ms 2892 KB Output is correct
4 Correct 56 ms 3808 KB Output is correct
5 Correct 48 ms 3128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 201 ms 8128 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 223 ms 8252 KB Output is correct
2 Correct 287 ms 14732 KB Output is correct
3 Correct 214 ms 13944 KB Output is correct
4 Correct 269 ms 17348 KB Output is correct
5 Correct 245 ms 15324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 234 ms 9800 KB Output is correct
2 Correct 261 ms 18932 KB Output is correct
3 Correct 256 ms 18332 KB Output is correct
4 Correct 335 ms 21464 KB Output is correct
5 Correct 287 ms 17676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 257 ms 9604 KB Output is correct
2 Correct 349 ms 17668 KB Output is correct
3 Correct 248 ms 16528 KB Output is correct
4 Correct 327 ms 21440 KB Output is correct
5 Correct 292 ms 18372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 276 ms 11336 KB Output is correct
2 Correct 308 ms 22164 KB Output is correct
3 Correct 313 ms 21464 KB Output is correct
4 Correct 380 ms 24716 KB Output is correct
5 Correct 343 ms 20188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 304 ms 11348 KB Output is correct
2 Correct 387 ms 20496 KB Output is correct
3 Correct 295 ms 19636 KB Output is correct
4 Correct 371 ms 24516 KB Output is correct
5 Correct 343 ms 21440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 324 ms 12868 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 344 ms 12756 KB Output is correct
2 Correct 443 ms 23348 KB Output is correct
3 Correct 338 ms 22352 KB Output is correct
4 Correct 426 ms 28276 KB Output is correct
5 Correct 393 ms 24388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 388 ms 15940 KB Output is correct
2 Correct 447 ms 31404 KB Output is correct
3 Correct 424 ms 30456 KB Output is correct
4 Correct 543 ms 35052 KB Output is correct
5 Correct 497 ms 29592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 427 ms 15936 KB Output is correct
2 Correct 547 ms 29232 KB Output is correct
3 Correct 426 ms 28308 KB Output is correct
4 Correct 535 ms 35208 KB Output is correct
5 Correct 489 ms 30788 KB Output is correct