結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー recososo
提出日時 2020-02-06 12:32:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 683 bytes
コンパイル時間 1,579 ms
コンパイル使用メモリ 174,928 KB
実行使用メモリ 19,392 KB
最終ジャッジ日時 2024-09-25 06:42:40
合計ジャッジ時間 8,791 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 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