답안 #970775

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
970775 2024-04-27T08:42:42 Z hihihihaw Mobile (BOI12_mobile) C++17
80 / 100
1000 ms 62880 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];
bool f(ld x){
    pair<ld,ld> z[n]={};
    ld b=0;
    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) return false;
    return true;
}
 
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=2000000000;
    while (r-l>0.001){
        ld m=(l+r)/2;
        if (f(m)) 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:96:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   96 |         freopen("socdist.in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:97:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   97 |         freopen("socdist.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 768 KB Output is correct
2 Correct 7 ms 604 KB Output is correct
3 Correct 6 ms 604 KB Output is correct
4 Correct 5 ms 780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 604 KB Output is correct
2 Correct 7 ms 756 KB Output is correct
3 Correct 6 ms 604 KB Output is correct
4 Correct 5 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 604 KB Output is correct
2 Correct 7 ms 604 KB Output is correct
3 Correct 6 ms 604 KB Output is correct
4 Correct 5 ms 600 KB Output is correct
5 Correct 6 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 7004 KB Output is correct
2 Correct 98 ms 7112 KB Output is correct
3 Correct 66 ms 4232 KB Output is correct
4 Correct 78 ms 7288 KB Output is correct
5 Correct 52 ms 4188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 6992 KB Output is correct
2 Correct 70 ms 4696 KB Output is correct
3 Correct 79 ms 7504 KB Output is correct
4 Correct 74 ms 7192 KB Output is correct
5 Correct 82 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 109 ms 7248 KB Output is correct
2 Correct 106 ms 7292 KB Output is correct
3 Correct 99 ms 7504 KB Output is correct
4 Correct 86 ms 7820 KB Output is correct
5 Correct 88 ms 7516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 129 ms 7840 KB Output is correct
2 Correct 128 ms 7844 KB Output is correct
3 Correct 123 ms 7844 KB Output is correct
4 Correct 87 ms 7772 KB Output is correct
5 Correct 101 ms 7760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 7848 KB Output is correct
2 Correct 128 ms 7852 KB Output is correct
3 Correct 121 ms 7760 KB Output is correct
4 Correct 89 ms 8064 KB Output is correct
5 Correct 96 ms 7760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 630 ms 32852 KB Output is correct
2 Correct 649 ms 32688 KB Output is correct
3 Correct 650 ms 32680 KB Output is correct
4 Correct 460 ms 32680 KB Output is correct
5 Correct 494 ms 32596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 647 ms 32688 KB Output is correct
2 Correct 561 ms 32644 KB Output is correct
3 Correct 598 ms 32880 KB Output is correct
4 Correct 454 ms 32592 KB Output is correct
5 Correct 496 ms 32684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 758 ms 39920 KB Output is correct
2 Correct 787 ms 39924 KB Output is correct
3 Correct 782 ms 39912 KB Output is correct
4 Correct 549 ms 39764 KB Output is correct
5 Correct 602 ms 44116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 782 ms 39804 KB Output is correct
2 Correct 664 ms 40056 KB Output is correct
3 Correct 709 ms 40080 KB Output is correct
4 Correct 553 ms 40016 KB Output is correct
5 Correct 575 ms 39820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 884 ms 45100 KB Output is correct
2 Correct 904 ms 45100 KB Output is correct
3 Correct 900 ms 45100 KB Output is correct
4 Correct 641 ms 45104 KB Output is correct
5 Correct 698 ms 49968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 916 ms 45168 KB Output is correct
2 Correct 755 ms 45108 KB Output is correct
3 Correct 830 ms 45100 KB Output is correct
4 Correct 649 ms 44952 KB Output is correct
5 Correct 683 ms 50508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1006 ms 52564 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1048 ms 52288 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1012 ms 62800 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1062 ms 62880 KB Time limit exceeded
2 Halted 0 ms 0 KB -