結果
問題 | No.2780 The Bottle Imp |
ユーザー |
![]() |
提出日時 | 2024-06-07 23:47:45 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 714 bytes |
コンパイル時間 | 3,527 ms |
コンパイル使用メモリ | 251,680 KB |
実行使用メモリ | 11,904 KB |
最終ジャッジ日時 | 2024-12-27 14:42:39 |
合計ジャッジ時間 | 5,071 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 36 WA * 4 |
ソースコード
#include<bits/stdc++.h>using namespace std;//#include<atcoder/all>//using namespace atcoder;using ll = long long;using ull = unsigned long long;#define rep(i,n) for(int i=0;i<(n);++i)int main(){ios::sync_with_stdio(false);cin.tie(nullptr);int n;cin >> n;vector<vector<int>> g(n);for(int i=0;i<n;++i){int m;cin >> m;for(int j=0;j<m;++j){int v;cin >> v;--v;g[i].emplace_back(v);}}vector<bool> seen(n);auto dfs = [&] (auto dfs,int v) -> void{seen[v] = true;for(auto next : g[v]){if(seen[next])continue;dfs(dfs,next);}};dfs(dfs,0);for(int i=0;i<n;++i){if(!seen[i]){cout << "No" << endl;return 0;}}cout << "Yes" << endl;}