Submission #5379476
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define REP(i, n) for(int i=0; i<n; i++) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } const ll MOD = 1e9+7; vector<int> G[100100]; vector<int> L[100100]; bool isvisit[100100]; void dfs(int v){ isvisit[v] = true; //for(auto l : L[v]){ // for(auto next : G[l]) { for(int i = 0; i < L[v].size(); i++){ int l = L[v][i]; for(int j = 0; j < G[l].size(); j++) { int next = G[l][j]; if(isvisit[next]) continue; dfs(next); } } } int main(){ int N, M; cin >> N >> M; REP(i,N){ int K; cin >> K; REP(j,K){ int l; cin >> l; l--; L[i].push_back(l); G[l].push_back(i); } } dfs(0); bool ans = true; REP(i,N){ if(!isvisit[i]) ans = false; } if(ans) cout << "YES" << endl; else cout << "NO" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | kurakura |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1247 Byte |
Status | TLE |
Exec Time | 2104 ms |
Memory | 12408 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 | 3 ms | 4992 KB |
01-02.txt | AC | 3 ms | 4992 KB |
01-03.txt | AC | 4 ms | 4992 KB |
01-04.txt | AC | 4 ms | 4992 KB |
01-05.txt | AC | 4 ms | 4992 KB |
01-06.txt | AC | 4 ms | 4992 KB |
01-07.txt | AC | 4 ms | 4992 KB |
01-08.txt | AC | 4 ms | 4992 KB |
01-09.txt | AC | 4 ms | 4992 KB |
01-10.txt | AC | 5 ms | 4992 KB |
02-01.txt | AC | 56 ms | 7808 KB |
02-02.txt | AC | 76 ms | 12160 KB |
02-03.txt | AC | 58 ms | 7552 KB |
02-04.txt | AC | 68 ms | 8192 KB |
02-05.txt | AC | 72 ms | 10624 KB |
02-06.txt | AC | 71 ms | 8192 KB |
02-07.txt | AC | 73 ms | 8576 KB |
02-08.txt | TLE | 2104 ms | 11640 KB |
02-09.txt | TLE | 2104 ms | 12408 KB |
02-10.txt | TLE | 2104 ms | 11640 KB |
02-11.txt | TLE | 2104 ms | 11640 KB |
02-12.txt | AC | 328 ms | 9728 KB |
02-13.txt | AC | 334 ms | 9472 KB |
sample-01.txt | AC | 3 ms | 4992 KB |
sample-02.txt | AC | 3 ms | 4992 KB |