Submission #7336715
Source Code Expand
#include<iostream> #include<vector> using namespace std; typedef long long ll; #define NODE_MAX 100001 vector<ll> lg[NODE_MAX],hg[NODE_MAX]; ll lang_used[NODE_MAX]={},human_used[NODE_MAX]={}; void lang_dfs(ll p); void human_dfs(ll p); void human_dfs(ll p){ if(human_used[p]){ return; } human_used[p]=true; for(ll i=0;i<hg[p].size();i++){ lang_dfs(hg[p][i]); } } void lang_dfs(ll p){ if(lang_used[p]){ return; } lang_used[p]=true; for(ll i=0;i<lg[p].size();i++){ human_dfs(lg[p][i]); } } signed main(){ ll n,m,tl; bool can=true; cin >> n >> m; ll k[n]; for(int i=0;i<n;i++){ cin >> k[i]; for(int j=0;j<k[i];j++){ cin >> tl; tl--; lg[tl].push_back(i); hg[i].push_back(tl); } } human_dfs(0); for(int i=0;i<n;i++){ if(human_used[i]==false){ can=false; break; } } if(can){ cout <<"YES\n"; }else{ cout <<"NO\n"; } }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | shop_one |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 990 Byte |
Status | AC |
Exec Time | 58 ms |
Memory | 10624 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, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 3 ms | 4992 KB |
01-02.txt | AC | 3 ms | 4992 KB |
01-03.txt | AC | 3 ms | 4992 KB |
01-04.txt | AC | 3 ms | 4992 KB |
01-05.txt | AC | 3 ms | 4992 KB |
01-06.txt | AC | 3 ms | 4992 KB |
01-07.txt | AC | 3 ms | 4992 KB |
01-08.txt | AC | 3 ms | 4992 KB |
01-09.txt | AC | 3 ms | 4992 KB |
01-10.txt | AC | 3 ms | 4992 KB |
02-01.txt | AC | 46 ms | 9344 KB |
02-02.txt | AC | 49 ms | 10624 KB |
02-03.txt | AC | 46 ms | 8960 KB |
02-04.txt | AC | 58 ms | 10112 KB |
02-05.txt | AC | 54 ms | 10496 KB |
02-06.txt | AC | 58 ms | 10112 KB |
02-07.txt | AC | 57 ms | 10624 KB |
02-08.txt | AC | 40 ms | 10352 KB |
02-09.txt | AC | 57 ms | 10356 KB |
02-10.txt | AC | 45 ms | 9972 KB |
02-11.txt | AC | 45 ms | 9972 KB |
02-12.txt | AC | 46 ms | 9856 KB |
02-13.txt | AC | 47 ms | 9984 KB |
sample-01.txt | AC | 3 ms | 4992 KB |
sample-02.txt | AC | 3 ms | 4992 KB |