結果
問題 |
No.977 アリス仕掛けの摩天楼
|
ユーザー |
|
提出日時 | 2021-09-30 22:28:33 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 750 bytes |
コンパイル時間 | 2,698 ms |
コンパイル使用メモリ | 198,220 KB |
最終ジャッジ日時 | 2025-01-24 18:43:36 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; vector <int> adj[100005]; int n,a,b; bool visited[100005]; int cnt = 0; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cin >> n; for(int i=0;i<n-1;i++) { cin >> a >> b; adj[a].push_back(b); adj[b].push_back(a); } memset(visited,false,sizeof(visited)); for(int i=0;i<n;i++) { if(visited[i]==false) { queue <int> que; cnt++; que.push(i); visited[i] = true; while(!que.empty()) { int now = que.front(); que.pop(); for(auto next : adj[now]) { if(visited[next]==false) { visited[next] = true; que.push(next); } } } } } if(cnt==1) cout << "Bob" << '\n'; else cout << "Alice" << '\n'; return 0; }