結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー shop_oneshop_one
提出日時 2020-01-31 21:47:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 794 bytes
コンパイル時間 705 ms
コンパイル使用メモリ 86,308 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2023-10-17 09:10:21
合計ジャッジ時間 2,168 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,344 KB
testcase_01 AC 3 ms
6,344 KB
testcase_02 AC 3 ms
6,344 KB
testcase_03 AC 3 ms
6,348 KB
testcase_04 AC 3 ms
6,348 KB
testcase_05 AC 3 ms
6,348 KB
testcase_06 AC 3 ms
6,348 KB
testcase_07 AC 3 ms
6,352 KB
testcase_08 AC 3 ms
6,356 KB
testcase_09 AC 3 ms
6,356 KB
testcase_10 WA -
testcase_11 AC 3 ms
6,356 KB
testcase_12 AC 3 ms
6,356 KB
testcase_13 AC 7 ms
6,872 KB
testcase_14 AC 6 ms
6,844 KB
testcase_15 AC 6 ms
6,896 KB
testcase_16 AC 6 ms
6,868 KB
testcase_17 AC 6 ms
7,036 KB
testcase_18 AC 16 ms
7,576 KB
testcase_19 WA -
testcase_20 AC 22 ms
8,368 KB
testcase_21 AC 37 ms
9,424 KB
testcase_22 AC 50 ms
10,480 KB
testcase_23 AC 63 ms
11,008 KB
testcase_24 AC 56 ms
11,008 KB
testcase_25 AC 60 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

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