結果
| 問題 | No.1769 Don't Stop the Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-29 04:28:41 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 924 bytes |
| 記録 | |
| コンパイル時間 | 6,651 ms |
| コンパイル使用メモリ | 258,028 KB |
| 実行使用メモリ | 42,872 KB |
| 最終ジャッジ日時 | 2026-06-23 13:05:28 |
| 合計ジャッジ時間 | 9,584 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 28 |
ソースコード
#include "testlib.h"
#include <numeric>
#include <cassert>
int main(int argc, char* argv[]) {
registerValidation(argc, argv);
int n = inf.readInt(2, 200'000); inf.readEoln();
std::vector<int> a(n - 1), b(n - 1), c(n - 1);
for(size_t i = 0; i + 1 < n; i++) {
a[i] = inf.readInt(1, n - 1); inf.readSpace();
b[i] = inf.readInt(a[i] + 1, n); inf.readSpace();
c[i] = inf.readInt(0, (1 << 30) - 1); inf.readEoln();
}
inf.readEof();
{ // check is_tree
std::vector<std::vector<int>> g(n);
for(size_t i = 0; i + 1 < n; i++) {
g[--a[i]].push_back(i);
g[--b[i]].push_back(i);
}
std::vector<int> used(n);
auto dfs = [&](auto&& dfs, int v, int par) -> void {
if(used[v]) return; used[v] = 1;
for(int id: g[v]) {
int to = a[id] ^ b[id] ^ v;
if(to == par) continue;
dfs(dfs, to, v);
}
}; dfs(dfs, 0, -1);
assert(std::accumulate(begin(used), end(used), 0) == n);
}
return 0;
}