結果

問題 No.977 アリス仕掛けの摩天楼
コンテスト
ユーザー startcpp
提出日時 2020-01-31 21:32:37
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 628 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 570 ms
コンパイル使用メモリ 79,304 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-04-06 04:16:20
合計ジャッジ時間 1,501 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

//これはギャグですか?
#include <iostream>
#include <vector>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

struct UF {
	int par[100000];
	UF() { int i; rep(i, 100000) par[i] = i; }
	int root(int x) { if (par[x] == x) return x; return par[x] = root(par[x]); }
	void unit(int x, int y) { x = root(x); y = root(y); par[x] = y; }
};

int n;
vector<int> et[100000];
UF uf;

int main() {
	int i;
	
	cin >> n;
	rep(i, n - 1) {
		int u, v;
		cin >> u >> v;
		uf.unit(u, v);
	}
	
	int rt = uf.root(0);
	rep(i, n) if (uf.root(i) != rt) { cout << "Alice" << endl; return 0; }
	cout << "Bob" << endl;
	return 0;
}
0