結果
問題 |
No.1719 Tree and Permutation
|
ユーザー |
![]() |
提出日時 | 2021-10-22 22:24:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 509 bytes |
コンパイル時間 | 711 ms |
コンパイル使用メモリ | 79,676 KB |
実行使用メモリ | 9,080 KB |
最終ジャッジ日時 | 2024-09-23 06:02:41 |
合計ジャッジ時間 | 3,765 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 6 |
ソースコード
#include <queue> #include <vector> #include <iostream> #include <algorithm> #include <functional> using namespace std; int main() { int Q; cin >> Q; while (Q--) { int N; cin >> N; vector<vector<int> > G(N); for (int i = 0; i < N - 1; ++i) { int a, b; cin >> a >> b; --a, --b; G[a].push_back(b); G[b].push_back(a); } bool answer = false; for (int i = 0; i < N; ++i) { if (G[i].size() >= 3) { answer = true; } } cout << (answer ? "Yes" : "No") << endl; } return 0; }