Submission #992613
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) { cout << #a << " = " << a << endl; } template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } typedef long long ll; int const inf = 1<<29; int main() { int N, M; cin >> N >> M; vector<vector<int>> G(N); rep(i, N) { int K; cin >> K; rep(i, K) { int l; cin >> l; G[i].push_back(l - 1); } } queue<int> q; q.push(0); vector<int> dist(N, inf); while(!q.empty()) { auto p = q.front(); q.pop(); for(auto e: G[p]) { if(dist[e] == inf) { dist[e] = dist[p] + 1; q.push(e); } } } bool ok = 1; rep(i, N) { ok &= dist[i] != inf; } cout << (ok ? "YES" : "NO") << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | motxx |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1114 Byte |
Status | WA |
Exec Time | 50 ms |
Memory | 3448 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 | WA | 3 ms | 256 KB |
01-03.txt | AC | 3 ms | 256 KB |
01-04.txt | WA | 3 ms | 256 KB |
01-05.txt | AC | 3 ms | 256 KB |
01-06.txt | WA | 3 ms | 256 KB |
01-07.txt | WA | 3 ms | 256 KB |
01-08.txt | AC | 3 ms | 384 KB |
01-09.txt | WA | 3 ms | 256 KB |
01-10.txt | WA | 3 ms | 256 KB |
02-01.txt | WA | 32 ms | 896 KB |
02-02.txt | AC | 43 ms | 3448 KB |
02-03.txt | AC | 33 ms | 1152 KB |
02-04.txt | WA | 42 ms | 2372 KB |
02-05.txt | WA | 43 ms | 2936 KB |
02-06.txt | AC | 42 ms | 2364 KB |
02-07.txt | WA | 45 ms | 3192 KB |
02-08.txt | AC | 37 ms | 3448 KB |
02-09.txt | WA | 50 ms | 3448 KB |
02-10.txt | WA | 44 ms | 3324 KB |
02-11.txt | AC | 44 ms | 3324 KB |
02-12.txt | WA | 40 ms | 2172 KB |
02-13.txt | AC | 39 ms | 2176 KB |
sample-01.txt | WA | 2 ms | 256 KB |
sample-02.txt | AC | 2 ms | 256 KB |