結果
問題 |
No.1719 Tree and Permutation
|
ユーザー |
👑 ![]() |
提出日時 | 2021-10-22 21:40:48 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 773 bytes |
コンパイル時間 | 2,826 ms |
コンパイル使用メモリ | 106,708 KB |
最終ジャッジ日時 | 2025-01-25 03:24:32 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 6 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(n); i++) int main(){ int T; cin >> T; while(T--){ int N; cin >> N; vector<vector<int>> E(N); rep(i,N-1){ int u,v; cin >> u >> v; u--; v--; E[u].push_back(v); E[v].push_back(u); } if(N%2 == 0){ cout << "Yes\n"; continue; } bool is_line = true; rep(i,N) if(E[i].size() >= 3) is_line = false; if(is_line) cout << "No\n"; else cout << "Yes\n"; } return 0; } struct ios_do_not_sync { ios_do_not_sync() { ios::sync_with_stdio(false); cin.tie(nullptr); } } ios_do_not_sync_instance;