답안 #1057606

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1057606 2024-08-14T00:04:41 Z lucascgar Mobile (BOI12_mobile) C++17
45 / 100
1000 ms 24764 KB
#include <bits/stdc++.h>

// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

using namespace std;

/*
chutar resposta x:
p toda torre achar achar menor e maior ponto com distância menor que x
se intervalo tem algum ponto cego: x é válido
se não, nn é

achar pontos p torre: busca binária

*/

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); // overclock random

typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
typedef pair<long double, long double> pdd;

const int MAXN = 1e6+10;
const double PRECISION = 1e-5;

long double dist(pdd a, pdd b){
    long double x = abs(a.first-b.first), y = abs(a.second-b.second);
    return x*x + y*y;
}

pii p[MAXN];
int l;

long double right(int t, long double d){
    long double sq = d*d;
    if (p[t].first > l) return l * (dist(p[t], {l,0}) <= sq);

    long double in=max(0, p[t].first), fi = l, me;

    if (dist({in,0}, p[t]) > sq) return -1;
    if (dist({l, 0}, p[t]) <= sq) return l;

    while (fi-in>=PRECISION){
        me = (in+fi)/2.00;

        if (dist({me, 0}, p[t]) <= sq){
            in = me;
        }else fi = me;

    }
    return in;

}

signed main(){
    std::ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // freopen("test.in", "r", stdin);
    // freopen("test.out", "w", stdout);
    cout << fixed << setprecision(5);

    int n;
    cin >> n >> l;

    for (int i=0;i<n;i++){
        cin >> p[i].first >> p[i].second;
    }

    long double in=0, fi = 2e9, me;

    while (fi-in >= PRECISION){
        me = (in+fi)/2.00;

        long double r=0;
        bool vl = 1;
        for (int i=0;i<n;i++){
            if (dist(p[i], {r, 0}) <= me*me){
                vl=0;
                r = right(i, me);
            }
        }


        vl = vl || (l!=r);
        if (vl) in=me;
        else fi=me;

    }

    cout << in << '\n';

    return 0;
}   
# 결과 실행 시간 메모리 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 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 2 ms 348 KB Output is correct
2 Correct 26 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 24 ms 520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 2 ms 480 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 532 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 165 ms 3420 KB Output is correct
2 Correct 29 ms 3676 KB Output is correct
3 Correct 48 ms 3164 KB Output is correct
4 Correct 23 ms 3676 KB Output is correct
5 Correct 18 ms 2908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 3416 KB Output is correct
2 Correct 25 ms 3416 KB Output is correct
3 Correct 31 ms 3672 KB Output is correct
4 Correct 26 ms 3832 KB Output is correct
5 Correct 28 ms 3932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1068 ms 3164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 4188 KB Output is correct
2 Correct 39 ms 3920 KB Output is correct
3 Correct 35 ms 3672 KB Output is correct
4 Correct 31 ms 4604 KB Output is correct
5 Correct 32 ms 3928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 991 ms 4188 KB Output is correct
2 Correct 40 ms 3932 KB Output is correct
3 Correct 35 ms 3676 KB Output is correct
4 Correct 29 ms 4620 KB Output is correct
5 Correct 32 ms 3912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1092 ms 8792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 132 ms 12788 KB Output is correct
2 Execution timed out 1097 ms 11088 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1022 ms 11860 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 16484 KB Output is correct
2 Execution timed out 1046 ms 14452 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1046 ms 12788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 216 ms 18160 KB Output is correct
2 Execution timed out 1063 ms 15956 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1030 ms 13552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 229 ms 19792 KB Output is correct
2 Execution timed out 1039 ms 17256 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1030 ms 16752 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 282 ms 24764 KB Output is correct
2 Execution timed out 1043 ms 21352 KB Time limit exceeded
3 Halted 0 ms 0 KB -