結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,320 KB
testcase_01 AC 3 ms
6,320 KB
testcase_02 AC 3 ms
6,320 KB
testcase_03 AC 3 ms
6,324 KB
testcase_04 AC 3 ms
6,324 KB
testcase_05 AC 3 ms
6,324 KB
testcase_06 AC 3 ms
6,324 KB
testcase_07 AC 3 ms
6,328 KB
testcase_08 AC 3 ms
6,332 KB
testcase_09 AC 3 ms
6,332 KB
testcase_10 WA -
testcase_11 AC 3 ms
6,332 KB
testcase_12 AC 3 ms
6,332 KB
testcase_13 AC 6 ms
6,848 KB
testcase_14 AC 6 ms
6,820 KB
testcase_15 AC 7 ms
6,872 KB
testcase_16 AC 6 ms
6,844 KB
testcase_17 AC 6 ms
7,012 KB
testcase_18 AC 14 ms
7,572 KB
testcase_19 WA -
testcase_20 AC 21 ms
8,364 KB
testcase_21 AC 32 ms
9,420 KB
testcase_22 AC 45 ms
10,476 KB
testcase_23 AC 53 ms
11,004 KB
testcase_24 AC 49 ms
11,004 KB
testcase_25 AC 52 ms
11,004 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);
  ll cnt=0;
  ll no_line=0,two_line=0;
  for(int i=0;i<n;i++){
    if(!used[i]) cnt++;
    if(G[i].size()==0) no_line++;
    if(G[i].size()==2) two_line++;
  }
  if(cnt==0||(cnt==1&&no_line==1&&two_line==1)) cout <<"Bob\n";
  else cout <<"Alice\n";
}
0