結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー musuchikamusuchika
提出日時 2020-01-31 23:15:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,216 bytes
コンパイル時間 1,827 ms
コンパイル使用メモリ 176,792 KB
実行使用メモリ 119,176 KB
最終ジャッジ日時 2023-10-17 12:24:21
合計ジャッジ時間 8,118 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 590 ms
16,032 KB
testcase_14 AC 186 ms
16,028 KB
testcase_15 AC 545 ms
16,288 KB
testcase_16 AC 590 ms
16,032 KB
testcase_17 AC 444 ms
16,816 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
vector<bool> isvisited;
vector<vector<bool>> isconnected;
int n;
void dfs(int x){
        isvisited[x]=true;
        rep(i,n){
            if(i==x)continue;
            if(isvisited[i])continue;
            if(isconnected[x][i]==true){
                dfs(i);
            }
        }
    };
int main(){
    cin>>n;
    isvisited.resize(n);
    isconnected.resize(n);
    rep(i,n)isconnected[i].resize(n);
    rep(i,n)rep(j,n)isconnected[i][j]=false;
    rep(i,n-1){
        int u,v;
        cin>>u>>v;
        isconnected[u][v]=isconnected[v][u]=true;
    }
    dfs(0);
    rep(i,n){
        if(!isvisited[i]){
            cout<<"Alice"<<endl;
            return 0;
        }
    }
    cout<<"Bob"<<endl;
    return 0;
}


0