結果
| 問題 | No.977 アリス仕掛けの摩天楼 |
| コンテスト | |
| ユーザー |
kagasan
|
| 提出日時 | 2020-03-09 18:31:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,409 bytes |
| 記録 | |
| コンパイル時間 | 2,046 ms |
| コンパイル使用メモリ | 175,532 KB |
| 実行使用メモリ | 10,240 KB |
| 最終ジャッジ日時 | 2024-11-08 16:47:28 |
| 合計ジャッジ時間 | 4,040 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 2 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;
V path[101010];
ll flg[101010];
ll cnt = 0;
int main(){
ll N;
cin >> N;
rep(i, N - 1){
ll a, b;
cin >> a >> b;
path[a].push_back(b);
path[b].push_back(a);
}
rep(i, N)if(flg[i] == 0){
cnt++;
flg[i] = cnt;
queue<ll>Q;
Q.push(i);
while(!Q.empty()){
ll idx = Q.front();
Q.pop();
for(auto to : path[idx])if(flg[to] == 0){
flg[to] = cnt;
Q.push(to);
}
}
}
if(cnt == 1)cout << "Bob" << endl;
else cout << "Alice" << endl;
return 0;
}
kagasan