Submission #1856985
Source Code Expand
#include<bits/stdc++.h> using namespace std; void dfs(vector<bool>& check, vector<bool>& used, vector<vector<bool> >& graph, int c, int n, int m){ check[c] = true; for(int i = 1; i <= n + m; i++){ if(used[i] == false && graph[c][i] == true){ used[i] = true; dfs(check, used, graph, i, n, m); used[i] = false; } } } 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> check(n + m + 1, false); vector<bool> used(n + m + 1, false); used[1] = true; dfs(check, used, graph, 1, n, m); bool flag = true; for(int i = 1; i <= n; i++){ if(check[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 | 0 |
Code Size | 1120 Byte |
Status | TLE |
Exec Time | 2525 ms |
Memory | 1352064 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, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 1 ms | 256 KB |
01-02.txt | TLE | 2103 ms | 384 KB |
01-03.txt | AC | 2 ms | 896 KB |
01-04.txt | AC | 4 ms | 384 KB |
01-05.txt | TLE | 2103 ms | 384 KB |
01-06.txt | AC | 4 ms | 640 KB |
01-07.txt | TLE | 2103 ms | 384 KB |
01-08.txt | AC | 4 ms | 640 KB |
01-09.txt | AC | 3 ms | 512 KB |
01-10.txt | AC | 5 ms | 896 KB |
02-01.txt | TLE | 2199 ms | 1352064 KB |
02-02.txt | TLE | 2185 ms | 1180672 KB |
02-03.txt | TLE | 2141 ms | 444800 KB |
02-04.txt | TLE | 2297 ms | -1214208 KB |
02-05.txt | TLE | 2174 ms | 994304 KB |
02-06.txt | TLE | 2298 ms | -1214208 KB |
02-07.txt | TLE | 2188 ms | 1228160 KB |
02-08.txt | TLE | 2188 ms | 1226112 KB |
02-09.txt | TLE | 2525 ms | -587008 KB |
02-10.txt | TLE | 2184 ms | 1226112 KB |
02-11.txt | TLE | 2184 ms | 1226112 KB |
02-12.txt | TLE | 2184 ms | 1226112 KB |
02-13.txt | TLE | 2185 ms | 1226112 KB |
sample-01.txt | AC | 2 ms | 384 KB |
sample-02.txt | AC | 1 ms | 256 KB |