Submission #992267
Source Code Expand
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
using namespace std;
#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL; typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;
typedef pair<int,int> pii;
struct Edge{
int from,to;
LL cost;
Edge(int from,int to, LL cost)
: from(from),to(to),cost(cost) {};
};
typedef vector<vector<Edge>> Graph;
int vis[100010];
void dfs(int s,vector<vector<int>> &l,vector<vector<int>> &p){
for(auto x : p[s]){
for(auto y:l[x]){
if(vis[y]==0){
vis[y]=1;
dfs(y,l,p);
}
}
}
return;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,m;
cin >> n>> m;
Graph G(n);
vector<vector<int>> l(m+1),p(n+1);
REP(i,n){
int tmp,tmp2;
cin >> tmp;
tmp--;
REP(j,tmp){
cin >> tmp2;
tmp2--;
l[tmp2].push_back(i);
p[i].push_back(tmp2);
}
}
dfs(0,l,p);
bool ans=true;
REP(i,n){
if(vis[i]==0){
ans=false;
break;
}
}
if(ans)cout << "YES" <<endl;
else cout << "NO"<<endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Interpretation |
User |
Hoi_koro |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
2021 Byte |
Status |
WA |
Exec Time |
156 ms |
Memory |
14192 KB |
Judge Result
Set Name |
sample |
dataset1 |
dataset2 |
Score / Max Score |
0 / 0 |
0 / 200 |
0 / 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 |
WA |
3 ms |
256 KB |
01-02.txt |
RE |
133 ms |
384 KB |
01-03.txt |
RE |
117 ms |
384 KB |
01-04.txt |
WA |
3 ms |
256 KB |
01-05.txt |
RE |
120 ms |
384 KB |
01-06.txt |
RE |
117 ms |
384 KB |
01-07.txt |
RE |
119 ms |
384 KB |
01-08.txt |
RE |
118 ms |
384 KB |
01-09.txt |
RE |
119 ms |
384 KB |
01-10.txt |
RE |
120 ms |
384 KB |
02-01.txt |
RE |
145 ms |
6392 KB |
02-02.txt |
RE |
146 ms |
7032 KB |
02-03.txt |
RE |
143 ms |
4476 KB |
02-04.txt |
RE |
156 ms |
10744 KB |
02-05.txt |
RE |
150 ms |
9084 KB |
02-06.txt |
RE |
155 ms |
11132 KB |
02-07.txt |
RE |
144 ms |
6908 KB |
02-08.txt |
AC |
21 ms |
6272 KB |
02-09.txt |
RE |
156 ms |
14192 KB |
02-10.txt |
RE |
144 ms |
8184 KB |
02-11.txt |
RE |
145 ms |
8316 KB |
02-12.txt |
RE |
143 ms |
8188 KB |
02-13.txt |
RE |
143 ms |
8264 KB |
sample-01.txt |
AC |
3 ms |
256 KB |
sample-02.txt |
AC |
3 ms |
256 KB |