Submission #992436
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> P; typedef pair<ll, ll> Pll; typedef vector<int> Vi; //typedef tuple<int, int, int> T; #define FOR(i,s,x) for(int i=s;i<(int)(x);i++) #define REP(i,x) FOR(i,0,x) #define ALL(c) c.begin(), c.end() #define DUMP( x ) cerr << #x << " = " << ( x ) << endl const int dr[4] = {-1, 0, 1, 0}; const int dc[4] = {0, 1, 0, -1}; int used[200010]; vector<int> edge[200010]; void dfs(int v) { used[v] = 1; for (int c : edge[v]) { if (not used[c]) dfs(c); } } int main() { // use scanf in CodeForces! cin.tie(0); ios_base::sync_with_stdio(false); int N, M; 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); REP(i, N) { if (not used[i]) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | n_knuu |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1017 Byte |
Status | AC |
Exec Time | 37 ms |
Memory | 8960 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 | 6 ms | 4992 KB |
01-02.txt | AC | 6 ms | 4992 KB |
01-03.txt | AC | 6 ms | 4992 KB |
01-04.txt | AC | 6 ms | 4992 KB |
01-05.txt | AC | 6 ms | 4992 KB |
01-06.txt | AC | 6 ms | 4992 KB |
01-07.txt | AC | 6 ms | 4992 KB |
01-08.txt | AC | 7 ms | 4992 KB |
01-09.txt | AC | 7 ms | 4992 KB |
01-10.txt | AC | 7 ms | 4992 KB |
02-01.txt | AC | 28 ms | 8320 KB |
02-02.txt | AC | 29 ms | 8960 KB |
02-03.txt | AC | 29 ms | 7808 KB |
02-04.txt | AC | 36 ms | 8704 KB |
02-05.txt | AC | 33 ms | 8960 KB |
02-06.txt | AC | 37 ms | 8704 KB |
02-07.txt | AC | 33 ms | 8832 KB |
02-08.txt | AC | 25 ms | 8824 KB |
02-09.txt | AC | 28 ms | 8824 KB |
02-10.txt | AC | 25 ms | 8824 KB |
02-11.txt | AC | 25 ms | 8824 KB |
02-12.txt | AC | 26 ms | 8832 KB |
02-13.txt | AC | 26 ms | 8832 KB |
sample-01.txt | AC | 6 ms | 4992 KB |
sample-02.txt | AC | 6 ms | 4992 KB |