結果
問題 |
No.1639 最小通信路
|
ユーザー |
![]() |
提出日時 | 2024-05-21 14:34:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 600 bytes |
コンパイル時間 | 7,199 ms |
コンパイル使用メモリ | 399,204 KB |
最終ジャッジ日時 | 2025-02-21 16:24:12 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | WA * 43 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/dsu> #include <boost/multiprecision/cpp_int.hpp> using namespace std; using namespace atcoder; using Bint = boost::multiprecision::cpp_int; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; Bint ans = 0; dsu uf(n); for (int i = 0; i < n * (n - 1) / 2; i++) { int a, b; Bint c; cin >> a >> b >> c; a--, b--; if (!uf.same(a, b)) { uf.merge(a, b); ans += c; } } cout << ans << endl; }