結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー shop_one
提出日時 2020-01-31 21:47:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 794 bytes
コンパイル時間 1,043 ms
コンパイル使用メモリ 84,948 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-09-17 07:37:08
合計ジャッジ時間 2,172 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
bool used[110000];
vector<ll> G[110000];
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
void dfs(int s){
  if(used[s]) return;
  used[s] = true;
  for(int v:G[s]){
    dfs(v);
  }
}
signed main(){
  init_io();
  ll n;
  cin >> n;
  vector<ll> w(n-1),v(n-1);
  for(int i=0;i<n-1;i++){
    cin >> w[i] >> v[i];
    G[w[i]].push_back(v[i]);
    G[v[i]].push_back(w[i]);
  }
  dfs(0);
  bool can = true;
  for(int i=0;i<n;i++){
    if(!used[i]) can=false;
  }
  if(can) cout <<"Bob\n";
  else cout <<"Alice\n";
}
0