Submission #1857019
Source Code Expand
#include<bits/stdc++.h> using namespace std; void dfs(vector<bool>& used, vector<vector<bool> >& graph, int c, int n, int m){ if(used[c]) return; used[c] = true; for(int i = 1; i <= n + m; i++){ if(graph[c][i]){ dfs(used, graph, i, n, m); } } } int main(void){ int n, m; cin >> n >> m; vector<vector<bool> > graph(n + m + 1, vector<bool> (n + m + 1, false)); for(int i = 1; i <= n; i++){ int k; cin >> k; for(int j = 0; j < k; j++){ int l; cin >> l; graph[i][n + l] = graph[n + l][i] = true; } } vector<bool> used(n + m + 1, false); dfs(used, graph, 1, n, m); bool flag = true; for(int i = 1; i <= n; i++){ if(used[i] == false){ flag = false; break; } } if(flag) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | monkukui |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 969 Byte |
Status | RE |
Exec Time | 2303 ms |
Memory | 1352064 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 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, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 1 ms | 256 KB |
01-02.txt | AC | 2 ms | 384 KB |
01-03.txt | AC | 2 ms | 896 KB |
01-04.txt | AC | 3 ms | 384 KB |
01-05.txt | AC | 3 ms | 384 KB |
01-06.txt | AC | 3 ms | 640 KB |
01-07.txt | AC | 3 ms | 384 KB |
01-08.txt | AC | 3 ms | 640 KB |
01-09.txt | AC | 3 ms | 512 KB |
01-10.txt | AC | 4 ms | 896 KB |
02-01.txt | TLE | 2187 ms | 1352064 KB |
02-02.txt | TLE | 2175 ms | 1178624 KB |
02-03.txt | TLE | 2131 ms | 445312 KB |
02-04.txt | TLE | 2303 ms | -1214208 KB |
02-05.txt | TLE | 2172 ms | 994432 KB |
02-06.txt | TLE | 2294 ms | -1214208 KB |
02-07.txt | TLE | 2186 ms | 1226112 KB |
02-08.txt | TLE | 2186 ms | 1226112 KB |
02-09.txt | RE | 2094 ms | -576212 KB |
02-10.txt | TLE | 2183 ms | 1225984 KB |
02-11.txt | TLE | 2182 ms | 1228032 KB |
02-12.txt | TLE | 2184 ms | 1225984 KB |
02-13.txt | TLE | 2184 ms | 1225984 KB |
sample-01.txt | AC | 3 ms | 384 KB |
sample-02.txt | AC | 1 ms | 256 KB |