結果
問題 |
No.977 アリス仕掛けの摩天楼
|
ユーザー |
|
提出日時 | 2020-01-31 21:36:54 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 704 bytes |
コンパイル時間 | 852 ms |
コンパイル使用メモリ | 122,624 KB |
実行使用メモリ | 8,192 KB |
最終ジャッジ日時 | 2024-11-30 16:17:52 |
合計ジャッジ時間 | 2,093 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 2 |
ソースコード
#include <cstdio> #include <bitset> #include <stack> #include <vector> constexpr int N = 1e5; std::bitset<N> P; std::vector<std::vector<int>> E; int main(void){ int n; scanf("%d", &n); E.assign(n, std::vector<int>(0)); for(int i = 1; i < n; ++i){ int u, v; scanf("%d%d", &u, &v); E[u].push_back(v); E[v].push_back(u); } std::stack<int> Stk; P[0] = true; Stk.push(0); while(not Stk.empty()){ int v = Stk.top(); Stk.pop(); for(int nv : E[v]) if(not P[nv]){ P[nv] = true; Stk.push(nv); } } int cnt;{cnt = 0; for(int i = 0; i < n; ++i) if(P[i]) cnt++;} if(cnt == n) puts("Bob"); else puts("Alice"); return 0; }