Submission #994335
Source Code Expand
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <queue> #include <map> typedef long long ll; #define rep(i, b) for(int i = 0; i < b; i++) #define repi(i, a, b) for(int i = a; i < b; i++) #if defined(_MSC_VER) || __cplusplus > 199711L #define aut(r,v) auto r = (v) #else #define aut(r,v) __typeof(v) r = (v) #endif #define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it) #define MAX_V 1001 #define MAX_E 401 #define MOD 1000000007 #define EPS 1e-7 #define INF INT_MAX #define PI 3.14159265358979323846264338327950288 inline ll toll(std::string s) { ll v; std::istringstream sin(s); sin >> v; return v; } template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); } using namespace std; typedef pair<ll, ll> pll; bool C_check[100002]; int main() { int N,M; cin >> N >> M; vector<int> K(N); vector< vector<int> > T(N); rep(i,N) { cin >> K[i]; rep(j,K[i]) { int L; cin >> L; T[i].push_back(L - 1); } sort(T[i].begin(),T[i].end()); } queue<int> que; que.push(0); C_check[0] = true; while ( !que.empty() ) { const ll cur = que.front(); que.pop(); rep(i,K[cur]) { rep(j,N) { if(binary_search(T[j].begin(),T[j].end(),T[cur][i]) && C_check[j] == false) { que.push(j); C_check[j] = true; } } } } rep(i,N) { if(C_check[i] == 0) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | otofu |
Language | C++14 (Clang 3.8.0) |
Score | 200 |
Code Size | 1898 Byte |
Status | TLE |
Exec Time | 2102 ms |
Memory | 6656 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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 9 ms | 888 KB |
01-02.txt | AC | 4 ms | 256 KB |
01-03.txt | AC | 4 ms | 384 KB |
01-04.txt | AC | 10 ms | 256 KB |
01-05.txt | AC | 10 ms | 256 KB |
01-06.txt | AC | 9 ms | 256 KB |
01-07.txt | AC | 8 ms | 256 KB |
01-08.txt | AC | 9 ms | 256 KB |
01-09.txt | AC | 10 ms | 256 KB |
01-10.txt | AC | 7 ms | 256 KB |
02-01.txt | TLE | 2102 ms | 1024 KB |
02-02.txt | TLE | 2102 ms | 6144 KB |
02-03.txt | TLE | 2102 ms | 1280 KB |
02-04.txt | TLE | 2102 ms | 3584 KB |
02-05.txt | TLE | 2102 ms | 4992 KB |
02-06.txt | TLE | 2102 ms | 3584 KB |
02-07.txt | TLE | 2102 ms | 5632 KB |
02-08.txt | TLE | 2102 ms | 6400 KB |
02-09.txt | TLE | 2102 ms | 6656 KB |
02-10.txt | TLE | 2102 ms | 3584 KB |
02-11.txt | TLE | 2102 ms | 3576 KB |
02-12.txt | TLE | 2102 ms | 3456 KB |
02-13.txt | TLE | 2102 ms | 3456 KB |
sample-01.txt | AC | 3 ms | 256 KB |
sample-02.txt | AC | 3 ms | 256 KB |