답안 #970781

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
970781 2024-04-27T08:50:40 Z hihihihaw Mobile (BOI12_mobile) C++17
80 / 100
1000 ms 63056 KB
#pragma GCC optimize("O3,unroll-loops")    
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define pii pair<int,int>
#define sz(v) (int)v.size()
#define fi first
#define se second
#define INF 1223372036854775807
#define MOD 1000000007
#define cint(x) int x;cin>>x;
#define cinarr(a,n) int a[n];for (int i=0;i<n;i++) cin>>a[i];
#define coutarr(a) for (auto d:a)cout<<d<<" "; cout<<endl;
#define coutarrD(a) for (auto d:a) cout<<d.fi<<","<<d.se<<" "; cout<<endl;
#define AYBERK_SARICA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
#define ld long double
#define mid (start+end)/2
 
int t=1;
int interactive=0;
int usaco=0;
int testCase=0;
int n,k;
pair<ld,ld> v[1000023];
void solve(){
    cin>>n>>k;
    for (int i=0;i<n;i++){
        ld x,y;
        cin>>x>>y;
        v[i]={x,y};
    }
    ld l=0,r=1500000000;
    pair<ld,ld> z[n]={};
    ld m,x,b;
    while (r-l>0.0005){
        m=(l+r)/2;
        b=0;
        x=m;
        for (int i=0;i<n;i++){
            if (x>v[i].se){
                ld y=sqrt(x*x-v[i].se*v[i].se);
                if (v[i].fi+y<0 || v[i].fi-y>k) continue;
                z[i]={max(v[i].fi-y,(ld)0),min(v[i].fi+y,(ld)k)};
                if (z[i].fi<=b) b=max(b,z[i].se);
            }
        }
        if (b==k) r=m;
        else l=m;
    }
    cout<<setprecision(15)<<l<<endl;
    
 
    
    
    
 
    
    
 
 
    
    
    
    
    
 
    
 
    
    
 
    
 
    
}
 
 
 
 
 
    
 
 
 
 
 
int32_t main(){
    AYBERK_SARICA;
    if (usaco){
        freopen("socdist.in", "r", stdin);
        freopen("socdist.out", "w", stdout);
    }
    if (!interactive){
    #ifdef Local
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        //freopen("wormsort.out", "w", stdout);
    #endif
    }
    if (t==1) solve();
    else{
        cin>>t;
        while (t--){testCase++;solve();}
    }
    
        
    return 0;
}

Compilation message

mobile.cpp: In function 'int32_t main()':
mobile.cpp:93:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   93 |         freopen("socdist.in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:94:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   94 |         freopen("socdist.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 772 KB Output is correct
2 Correct 5 ms 772 KB Output is correct
3 Correct 7 ms 604 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 604 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Correct 5 ms 604 KB Output is correct
4 Correct 4 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Correct 5 ms 604 KB Output is correct
4 Correct 8 ms 604 KB Output is correct
5 Correct 6 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 7056 KB Output is correct
2 Correct 79 ms 7000 KB Output is correct
3 Correct 52 ms 4236 KB Output is correct
4 Correct 92 ms 7244 KB Output is correct
5 Correct 51 ms 4600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 7164 KB Output is correct
2 Correct 84 ms 4868 KB Output is correct
3 Correct 96 ms 7260 KB Output is correct
4 Correct 95 ms 6992 KB Output is correct
5 Correct 107 ms 7308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 92 ms 7512 KB Output is correct
2 Correct 85 ms 7292 KB Output is correct
3 Correct 79 ms 7260 KB Output is correct
4 Correct 130 ms 7764 KB Output is correct
5 Correct 102 ms 7508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 103 ms 7844 KB Output is correct
2 Correct 103 ms 7772 KB Output is correct
3 Correct 90 ms 7844 KB Output is correct
4 Correct 129 ms 7840 KB Output is correct
5 Correct 137 ms 7796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 7844 KB Output is correct
2 Correct 107 ms 7800 KB Output is correct
3 Correct 90 ms 7824 KB Output is correct
4 Correct 133 ms 7816 KB Output is correct
5 Correct 118 ms 7848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 538 ms 32652 KB Output is correct
2 Correct 539 ms 32888 KB Output is correct
3 Correct 520 ms 32680 KB Output is correct
4 Correct 643 ms 32684 KB Output is correct
5 Correct 644 ms 32684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 544 ms 32652 KB Output is correct
2 Correct 417 ms 32656 KB Output is correct
3 Correct 453 ms 32688 KB Output is correct
4 Correct 653 ms 32684 KB Output is correct
5 Correct 602 ms 32636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 631 ms 40020 KB Output is correct
2 Correct 625 ms 39920 KB Output is correct
3 Correct 620 ms 39916 KB Output is correct
4 Correct 805 ms 39920 KB Output is correct
5 Correct 705 ms 39760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 627 ms 39764 KB Output is correct
2 Correct 480 ms 39920 KB Output is correct
3 Correct 553 ms 39916 KB Output is correct
4 Correct 800 ms 40064 KB Output is correct
5 Correct 719 ms 39764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 715 ms 44936 KB Output is correct
2 Correct 731 ms 44880 KB Output is correct
3 Correct 722 ms 44932 KB Output is correct
4 Correct 909 ms 45100 KB Output is correct
5 Correct 836 ms 44880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 748 ms 45100 KB Output is correct
2 Correct 598 ms 45104 KB Output is correct
3 Correct 658 ms 45104 KB Output is correct
4 Correct 905 ms 45104 KB Output is correct
5 Correct 840 ms 44884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 827 ms 52340 KB Output is correct
2 Correct 827 ms 52332 KB Output is correct
3 Correct 835 ms 52304 KB Output is correct
4 Execution timed out 1040 ms 52564 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 864 ms 52564 KB Output is correct
2 Correct 619 ms 52336 KB Output is correct
3 Correct 724 ms 52308 KB Output is correct
4 Execution timed out 1049 ms 52340 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1036 ms 63056 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1034 ms 62892 KB Time limit exceeded
2 Halted 0 ms 0 KB -