답안 #970779

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
970779 2024-04-27T08:46:55 Z hihihihaw Mobile (BOI12_mobile) C++17
90 / 100
1000 ms 78704 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]={};
    while (r-l>0.0005){
        ld m=(l+r)/2;
        ld b=0;
        ld x=m;
        for (int i=0;i<n;i++){
            if (x*x-v[i].se*v[i].se>0){
                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:92:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   92 |         freopen("socdist.in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
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.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 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 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 600 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 732 KB Output is correct
4 Correct 4 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 604 KB Output is correct
2 Correct 6 ms 856 KB Output is correct
3 Correct 5 ms 600 KB Output is correct
4 Correct 3 ms 612 KB Output is correct
5 Correct 4 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 66 ms 7056 KB Output is correct
2 Correct 81 ms 7044 KB Output is correct
3 Correct 48 ms 4336 KB Output is correct
4 Correct 49 ms 7004 KB Output is correct
5 Correct 35 ms 4228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 6996 KB Output is correct
2 Correct 49 ms 4732 KB Output is correct
3 Correct 54 ms 7248 KB Output is correct
4 Correct 52 ms 7052 KB Output is correct
5 Correct 53 ms 7316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 7468 KB Output is correct
2 Correct 86 ms 7320 KB Output is correct
3 Correct 79 ms 7284 KB Output is correct
4 Correct 58 ms 7760 KB Output is correct
5 Correct 60 ms 7260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 103 ms 7760 KB Output is correct
2 Correct 101 ms 7852 KB Output is correct
3 Correct 91 ms 7844 KB Output is correct
4 Correct 69 ms 7800 KB Output is correct
5 Correct 85 ms 7764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 95 ms 7764 KB Output is correct
2 Correct 112 ms 7840 KB Output is correct
3 Correct 87 ms 7764 KB Output is correct
4 Correct 58 ms 7816 KB Output is correct
5 Correct 67 ms 7812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 560 ms 32596 KB Output is correct
2 Correct 525 ms 32684 KB Output is correct
3 Correct 540 ms 32852 KB Output is correct
4 Correct 340 ms 32644 KB Output is correct
5 Correct 323 ms 32632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 529 ms 32592 KB Output is correct
2 Correct 441 ms 32920 KB Output is correct
3 Correct 445 ms 32688 KB Output is correct
4 Correct 336 ms 32680 KB Output is correct
5 Correct 316 ms 32592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 596 ms 39820 KB Output is correct
2 Correct 642 ms 40064 KB Output is correct
3 Correct 615 ms 39916 KB Output is correct
4 Correct 373 ms 39760 KB Output is correct
5 Correct 439 ms 40020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 644 ms 39920 KB Output is correct
2 Correct 529 ms 39764 KB Output is correct
3 Correct 559 ms 40208 KB Output is correct
4 Correct 358 ms 39812 KB Output is correct
5 Correct 427 ms 40020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 688 ms 45100 KB Output is correct
2 Correct 785 ms 45140 KB Output is correct
3 Correct 718 ms 45100 KB Output is correct
4 Correct 433 ms 44884 KB Output is correct
5 Correct 503 ms 44936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 743 ms 45100 KB Output is correct
2 Correct 574 ms 45100 KB Output is correct
3 Correct 673 ms 45100 KB Output is correct
4 Correct 449 ms 44956 KB Output is correct
5 Correct 486 ms 45188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 811 ms 52108 KB Output is correct
2 Correct 868 ms 52560 KB Output is correct
3 Correct 832 ms 52336 KB Output is correct
4 Correct 502 ms 52308 KB Output is correct
5 Correct 556 ms 63372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 858 ms 52340 KB Output is correct
2 Correct 688 ms 52332 KB Output is correct
3 Correct 726 ms 52332 KB Output is correct
4 Correct 484 ms 52336 KB Output is correct
5 Correct 558 ms 63864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 954 ms 62864 KB Output is correct
2 Execution timed out 1031 ms 78704 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1004 ms 62848 KB Time limit exceeded
2 Halted 0 ms 0 KB -