답안 #513030

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
513030 2022-01-17T01:17:49 Z KoD Odašiljači (COCI20_odasiljaci) C++17
49 / 70
1000 ms 308 KB
#include <bits/stdc++.h>

using std::vector;
using std::array;
using std::pair;
using std::tuple;

using i64 = std::int64_t;

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int N;
    std::cin >> N;
    vector<double> X(N), Y(N);
    for (int i = 0; i < N; ++i) {
        std::cin >> X[i] >> Y[i];
    }
    const auto check = [&](const double thres) {
        vector<char> reach(N);
        std::queue<int> que;
        const auto push = [&](const int u) {
            if (!reach[u]) {
                reach[u] = true;
                que.push(u);
            }
        };
        push(0);
        while (!que.empty()) {
            const int u = que.front();
            que.pop();
            for (int v = 0; v < N; ++v) {
                if (std::hypot(X[u] - X[v], Y[u]- Y[v]) <= 2.0 * thres) {
                    push(v);
                }
            }
        }
        return std::count(reach.begin(), reach.end(), true) == N;
    };
    double ok = 2.0 * 1e9, ng = 0.0;
    for (int step = 0; step < 50; ++step) {
        const double md = (ok + ng) / 2.0;
        (check(md) ? ok : ng) = md;
    }
    std::cout << std::fixed << std::setprecision(20);
    std::cout << ok << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 4 ms 204 KB Output is correct
4 Correct 7 ms 204 KB Output is correct
5 Correct 11 ms 308 KB Output is correct
6 Correct 243 ms 308 KB Output is correct
7 Correct 295 ms 304 KB Output is correct
8 Correct 656 ms 204 KB Output is correct
9 Execution timed out 1084 ms 204 KB Time limit exceeded
10 Execution timed out 1079 ms 204 KB Time limit exceeded