結果
問題 |
No.977 アリス仕掛けの摩天楼
|
ユーザー |
![]() |
提出日時 | 2020-01-31 23:15:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,216 bytes |
コンパイル時間 | 1,752 ms |
コンパイル使用メモリ | 176,088 KB |
実行使用メモリ | 121,500 KB |
最終ジャッジ日時 | 2024-09-17 10:33:16 |
合計ジャッジ時間 | 7,975 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 1 TLE * 1 -- * 7 |
ソースコード
#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; }