結果

問題 No.2214 Products on Tree
コンテスト
ユーザー nok0
提出日時 2022-11-29 10:35:45
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.90.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 416 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,773 ms
コンパイル使用メモリ 336,440 KB
実行使用メモリ 20,984 KB
最終ジャッジ日時 2026-06-28 16:30:10
合計ジャッジ時間 8,868 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

#include "testlib.h"

#include <atcoder/dsu>

int main() {
	registerValidation();
	int n = inf.readInt(2, 200000);
	atcoder::dsu uf(n);
	inf.readEoln();
	for(int i = 0; i < n - 1; i++) {
		int a = inf.readInt(1, n);
		inf.readSpace();
		int b = inf.readInt(a + 1, n);
		inf.readEoln();
		uf.merge(a - 1, b - 1);
	}
	ensure(uf.size(0) == n);
	inf.readEof();
	return 0;
}
0