結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー recososorecososo
提出日時 2020-02-06 12:32:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 683 bytes
コンパイル時間 1,591 ms
コンパイル使用メモリ 174,196 KB
実行使用メモリ 14,480 KB
最終ジャッジ日時 2023-10-25 22:26:50
合計ジャッジ時間 8,872 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int nmax=100005;
vector<vector<int>> g(nmax);
bool vis[nmax];
void bfs(int s){
    stack<int> st;
    vis[s]=true;
    st.push(s);
    while(!st.empty()){
        int p=st.top();
        for(auto x:g[p]){
            if(!vis[x]){
                vis[x]=true;
                st.push(x);
            }
        }
    }
}
int main(){
    int n;cin >> n;
    for(int i=0;i<n-1;i++){
        int a,b;cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    bfs(0);
    for(int i=0;i<n;i++){
        if(!vis[i]){
            cout << "Alice" << endl;
            return 0;
        }
    }
    cout << "Bob" << endl;
}
0