Submission #992168
Source Code Expand
#include<sstream> #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<string> #include<vector> #include<set> #include<map> #include<queue> #include<numeric> #include<functional> #include<algorithm> using namespace std; #define INF (1<<29) #define rep(i,n) for(int i=0;i<(n);i++) #define all(v) v.begin(),v.end() #define uniq(v) v.erase(unique(all(v)),v.end()) using namespace std; int n,m; bool visited[200000]; vector<int> edge[200000]; void dfs(int u){ if (visited[u])return; visited[u]=true; for (int v:edge[u]){ dfs(v); } } int main(){ cin>>n>>m; rep(i,n){ int k; cin>>k; rep(j,k){ int L; cin>>L; L--; edge[i].push_back(n+L); edge[n + L].push_back(i); } } dfs(0); cout << (all_of(visited, visited + n, [](bool f){return f;})?"YES":"NO")<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | hirokazu1020 |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 905 Byte |
Status | AC |
Exec Time | 71 ms |
Memory | 8704 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 200 / 200 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
dataset1 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt |
dataset2 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 7 ms | 4992 KB |
01-02.txt | AC | 7 ms | 4992 KB |
01-03.txt | AC | 8 ms | 4992 KB |
01-04.txt | AC | 8 ms | 4992 KB |
01-05.txt | AC | 8 ms | 4992 KB |
01-06.txt | AC | 8 ms | 4992 KB |
01-07.txt | AC | 8 ms | 4992 KB |
01-08.txt | AC | 7 ms | 4992 KB |
01-09.txt | AC | 8 ms | 4992 KB |
01-10.txt | AC | 8 ms | 4992 KB |
02-01.txt | AC | 55 ms | 7936 KB |
02-02.txt | AC | 64 ms | 8704 KB |
02-03.txt | AC | 56 ms | 7680 KB |
02-04.txt | AC | 70 ms | 8192 KB |
02-05.txt | AC | 68 ms | 8576 KB |
02-06.txt | AC | 71 ms | 8192 KB |
02-07.txt | AC | 70 ms | 8576 KB |
02-08.txt | AC | 57 ms | 8568 KB |
02-09.txt | AC | 71 ms | 8568 KB |
02-10.txt | AC | 59 ms | 8568 KB |
02-11.txt | AC | 59 ms | 8568 KB |
02-12.txt | AC | 58 ms | 8448 KB |
02-13.txt | AC | 59 ms | 8448 KB |
sample-01.txt | AC | 7 ms | 4992 KB |
sample-02.txt | AC | 7 ms | 4992 KB |