Submission #993941
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; int ma[10002][10002]; int T[10002][10002]; int check[100002]; int main() { int N,M; cin >> N >> M; vector<int> K(N); rep(i,10002) { rep(j,10002) { ma[i][j] = 0; T[i][j] = -1; } } rep(i,N) { int count = 0; cin >> K[i]; rep(j,K[i]) { int L; cin >> L; ma[i][L - 1] = 1; T[i][count++] = L - 1; } } queue<int> que; que.push(0); check[0] = 1; while ( !que.empty() ) { const ll cur = que.front(); que.pop(); rep(i,K[cur]) { rep(j,N) { if(ma[j][T[cur][i]] == 1 && check[j] == 0) { que.push(j); check[j] = 1; } } } } rep(i,N) { if(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 (GCC 5.4.1) |
Score | 0 |
Code Size | 1995 Byte |
Status | MLE |
Exec Time | 2142 ms |
Memory | 782208 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 | MLE | 795 ms | 781824 KB |
01-02.txt | MLE | 791 ms | 781824 KB |
01-03.txt | MLE | 793 ms | 781824 KB |
01-04.txt | MLE | 804 ms | 781824 KB |
01-05.txt | MLE | 798 ms | 781824 KB |
01-06.txt | MLE | 795 ms | 781824 KB |
01-07.txt | MLE | 794 ms | 781824 KB |
01-08.txt | MLE | 798 ms | 781824 KB |
01-09.txt | MLE | 799 ms | 781824 KB |
01-10.txt | MLE | 808 ms | 781824 KB |
02-01.txt | TLE | 2142 ms | 781824 KB |
02-02.txt | MLE | 936 ms | 782208 KB |
02-03.txt | MLE | 941 ms | 781824 KB |
02-04.txt | MLE | 917 ms | 782080 KB |
02-05.txt | MLE | 907 ms | 782080 KB |
02-06.txt | MLE | 911 ms | 782080 KB |
02-07.txt | MLE | 910 ms | 782208 KB |
02-08.txt | MLE | 905 ms | 782208 KB |
02-09.txt | MLE | 913 ms | 782208 KB |
02-10.txt | MLE | 909 ms | 781952 KB |
02-11.txt | MLE | 905 ms | 781952 KB |
02-12.txt | MLE | 911 ms | 781952 KB |
02-13.txt | MLE | 910 ms | 781952 KB |
sample-01.txt | MLE | 787 ms | 781824 KB |
sample-02.txt | MLE | 790 ms | 781824 KB |