Submission #5425374
Source Code Expand
#include <iostream> #include <string> #include <functional> #include <algorithm> #include <vector> #include <queue> #include <math.h> #include <map> using namespace std; using ll = long long; int main() { int n, m; cin >> n >> m; map<int, vector <int> > l2m; map<int, vector <int> > adj; for (int i = 0; i < n; ++i) { int k; cin >> k; k--; for (int j = 0; j < k; ++j) { int l; cin >> l; l--; l2m[j].push_back(i); for (auto hito: l2m[j]) { adj[hito].push_back(i); adj[i].push_back(hito); } } } queue<int>q; vector<bool>cat(n, false); q.push(0); cat[0] = true; while (!q.empty()) { int oya = q.front(); q.pop(); for (int child : adj[oya]) { if (!cat[child]) { q.push(child); cat[child] = true; } } } bool flag = true; for (bool isadj : cat) flag = flag && isadj; if (flag) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | tube_worm |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1015 Byte |
Status | WA |
Exec Time | 2134 ms |
Memory | 740092 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 | WA | 1 ms | 256 KB |
01-02.txt | AC | 10 ms | 3584 KB |
01-03.txt | TLE | 2133 ms | 400392 KB |
01-04.txt | WA | 4 ms | 896 KB |
01-05.txt | AC | 8 ms | 2560 KB |
01-06.txt | TLE | 2134 ms | 384868 KB |
01-07.txt | WA | 930 ms | 166344 KB |
01-08.txt | MLE | 1597 ms | 263392 KB |
01-09.txt | WA | 69 ms | 20224 KB |
01-10.txt | WA | 850 ms | 162448 KB |
02-01.txt | TLE | 2118 ms | 618024 KB |
02-02.txt | TLE | 2129 ms | 339372 KB |
02-03.txt | TLE | 2115 ms | 640664 KB |
02-04.txt | TLE | 2107 ms | 578908 KB |
02-05.txt | TLE | 2128 ms | 597768 KB |
02-06.txt | TLE | 2111 ms | 643312 KB |
02-07.txt | TLE | 2122 ms | 675896 KB |
02-08.txt | TLE | 2119 ms | 219904 KB |
02-09.txt | TLE | 2111 ms | 629180 KB |
02-10.txt | TLE | 2113 ms | 740092 KB |
02-11.txt | TLE | 2114 ms | 607652 KB |
02-12.txt | TLE | 2111 ms | 625564 KB |
02-13.txt | TLE | 2113 ms | 619268 KB |
sample-01.txt | AC | 1 ms | 256 KB |
sample-02.txt | AC | 1 ms | 256 KB |