結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー startcpp
提出日時 2020-01-31 21:32:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 70,712 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-17 07:17:17
合計ジャッジ時間 2,073 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

//これはギャグですか?
#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