AtCoder abc257 D
// compile: g++ -o data data.cpp -O3 -std=gnu++20 -Wall -Wextra -Wshadow -D_GLIBCXX_ASSERTIONS -ggdb3 -fmax-errors=2 -DLOCAL
// run: ./data < in/01_random_02.txt
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#ifdef LOCAL
#include <debug/codeforces.h>
#define debug(x...) _debug_print(#x, x);
#else
#define debug(x...)
#endif
template<typename...Args> void print_(Args...args){((cout<<args<<" "),...)<<endl;}
#define rep(i,a,b) for(int i=(a);i<(int)(b);++i)
#define sz(v) ((int)(v).size())
#define print(...) print_(__VA_ARGS__);
#define INTMAX (int)(9223372036854775807)
#define INF (int)(1152921504606846976)
#define double long double
#define int long long
#define MAXN 200010

int n;
struct graph {
    struct node {
        int u, v;
        double w;
    };
    vector<vector<node>> e;
    int n, m;
    bool directed;
    vector<int> vis;
    graph(int V, bool D = 0) {
        n = V;
        e.resize(n);
        vis.resize(n);
        directed = D;
    }
    void add_edge(int u, int v, double w = 1) {
        e[u].push_back(node{u, v, w});
        ++m;
    }
    void graphviz_dump(string filename = "graph.dot") {
        ofstream gf;
        gf.open(filename);
        gf << (directed ? "digraph" : "graph") << " {\n";
        gf << "    "; rep(i, 0, n) gf << i << " ;"[i==n-1]; gf << endl;
        string notation = directed ? " -> " : " -- ";
        for (auto es: e) {
            for (auto edge: es) {
                gf << "    " << edge.u << notation << edge.v << (directed ? " ;\n" : ";\n");
            }
        }
        gf << "}\n";
    }
    int cnt = 0;
    void dfs(int u, double th) {
        vis[u] = 1;
        ++cnt;
        for (auto ed: e[u]) {
            if (ed.w > th) continue;
            if (!vis[ed.v]) dfs(ed.v, th);
        }
    }
    bool solve(double th) {
        rep(i, 0, n) {
            cnt = 0;
            fill(vis.begin(), vis.end(), 0);
            dfs(i, th);
            if (cnt == n) return 1;
        }
        return 0;
    }
};

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    cin >> n;
    vector<int> x(n), y(n), p(n);
    rep(i, 0, n) cin >> x[i] >> y[i] >> p[i];
    graph g(n);
    rep(i, 0, n) rep(j, 0, n) {
        if (i == j) continue;
        g.add_edge(i, j, (abs(x[i] - x[j]) + abs(y[i] - y[j])) * 1.0 / p[i]);
    }
    double l = 0, r = 1e10, mid = (l + r) / 2;
    while (r-l > 0.01) {
        mid = (l + r) / 2;
        if (g.solve(mid)) r = mid;
        else l = mid;
    }
    cout << (int)ceil(mid - 0.01) << endl;

    return 0;
}

Comments

  1. 11 months ago
    2025-12-06 2:27:46

    Getting the game was simple with y444gamedownload. Straightforward and quick. Zero hassle. Get it downloaded from y444gamedownload

  2. 11 months ago
    2025-12-19 13:42:48

    Yo peeps, 88clbgame is where it’s at! Loads of different games to keep you busy. I especially liked the selection they got. Hit them up here 88clbgame!

  3. 10 months ago
    2025-12-29 6:11:02

    Gave 11betorg a whirl. It’s… okay. It’s got the basics covered, I guess, but there’s nothing that really makes it stand out. If you’re not too picky, it’s fine. Decide for yourself: 11betorg

  4. 1 month ago
    2026-9-19 12:46:57

    [4993]Xbet – Link vào trang chủ và game bài đổi thưởng uy tín,Truy cập xbet để trải nghiệm game bài đổi thưởng uy tín. Hướng dẫn tải app xbet nhanh chóng và cách nạp tiền qua Momo tiện lợi. Đăng ký tham gia ngay hôm nay. visit: xbet

  5. 1 month ago
    2026-9-26 8:52:02

    Really impressed with the user interface here. Everything is easy to find and the loading times are super fast. Big thanks to canohuto for the great experience

  6. 2 weeks ago
    2026-10-18 23:18:00

    Fast deposits and even faster withdrawals. That is all I really care about and this site delivers every time. Check out kr10bet now.

  7. 7 days ago
    2026-10-26 14:44:02

    Super impressed with the customer support. They answered my questions almost instantly. It is rare to find such a helpful team in this industry. krezbet

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
Previous
Next