Submission #1010127

# Submission time Handle Problem Language Result Execution time Memory
1010127 2024-06-28T10:53:16 Z Psiuk_Yurii Mobile (BOI12_mobile) C++14
85 / 100
1000 ms 51032 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
typedef pair<ll,pll> ppl;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

ll n;
ld u,L,R,eps;
pld p[1000009];

bool can(ld R){
   ld r=0.0;
   for(int i=1;i<=n;i++){
       if(R>=p[i].second){
           ld x0=p[i].first-sqrt(R*R-p[i].second*p[i].second);
           if(x0<=r) {
                ld x1=p[i].first+sqrt(R*R-p[i].second*p[i].second);
                r=max(x1,r);
                if(r>=u) return true;
           }
       }
   }
  return false;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>u;
    for(int i=1;i<=n;i++) {cin>>p[i].first>>p[i].second; p[i].second=abs(p[i].second);}
    eps=0.001;
    L=0.0; R=1000000000.0;
    while(L<R-eps){
        ld mid=(L+R)*0.5;
        if(can(mid)) R=mid;
        else L=mid;
    }
    cout<<fixed<<setprecision(5)<<L;


    return 0;
}

Compilation message

mobile.cpp:11: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
   11 | #pragma comment(linker, "/stack:200000000")
      |
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 6 ms 752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 672 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 572 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 3 ms 672 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 3592 KB Output is correct
2 Correct 47 ms 3920 KB Output is correct
3 Correct 23 ms 2648 KB Output is correct
4 Correct 31 ms 3920 KB Output is correct
5 Correct 16 ms 2432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 3644 KB Output is correct
2 Correct 24 ms 3420 KB Output is correct
3 Correct 26 ms 3924 KB Output is correct
4 Correct 37 ms 3924 KB Output is correct
5 Correct 36 ms 4420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 3676 KB Output is correct
2 Correct 43 ms 4188 KB Output is correct
3 Correct 34 ms 3928 KB Output is correct
4 Correct 45 ms 5460 KB Output is correct
5 Correct 30 ms 3924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 98 ms 4948 KB Output is correct
2 Correct 60 ms 4944 KB Output is correct
3 Correct 46 ms 4444 KB Output is correct
4 Correct 44 ms 5460 KB Output is correct
5 Correct 35 ms 4812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 142 ms 4944 KB Output is correct
2 Correct 60 ms 4956 KB Output is correct
3 Correct 47 ms 4468 KB Output is correct
4 Correct 61 ms 5460 KB Output is correct
5 Correct 37 ms 4692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 767 ms 20308 KB Output is correct
2 Correct 317 ms 23628 KB Output is correct
3 Correct 225 ms 23120 KB Output is correct
4 Correct 223 ms 25172 KB Output is correct
5 Correct 182 ms 22868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 382 ms 24252 KB Output is correct
2 Correct 542 ms 22680 KB Output is correct
3 Correct 227 ms 21844 KB Output is correct
4 Correct 218 ms 24844 KB Output is correct
5 Correct 189 ms 22868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 979 ms 24360 KB Output is correct
2 Correct 336 ms 27952 KB Output is correct
3 Correct 252 ms 26964 KB Output is correct
4 Correct 240 ms 30004 KB Output is correct
5 Correct 223 ms 26708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 436 ms 28244 KB Output is correct
2 Correct 574 ms 26568 KB Output is correct
3 Correct 287 ms 25488 KB Output is correct
4 Correct 236 ms 29776 KB Output is correct
5 Correct 200 ms 26960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 27988 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 471 ms 32848 KB Output is correct
2 Correct 698 ms 31024 KB Output is correct
3 Correct 331 ms 29776 KB Output is correct
4 Correct 290 ms 34272 KB Output is correct
5 Correct 278 ms 31640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1039 ms 31936 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 652 ms 37312 KB Output is correct
2 Correct 804 ms 35040 KB Output is correct
3 Correct 346 ms 34136 KB Output is correct
4 Correct 336 ms 39248 KB Output is correct
5 Correct 349 ms 36180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 39564 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 832 ms 46720 KB Output is correct
2 Correct 972 ms 43616 KB Output is correct
3 Correct 469 ms 43864 KB Output is correct
4 Correct 487 ms 51032 KB Output is correct
5 Correct 408 ms 46416 KB Output is correct