Submission #992057
Source Code Expand
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<pii,int> piii; typedef pair<ll,ll> pll; #define reps(i,f,n) for(int i = int(f); i <= int(n); i++) #define rep(i,n) reps(i,0,int(n)-1) #define rrep(i,n) for(int i = n-1; i >= 0; i--) #define all(x) (x).begin(),(x).end() #define X first #define Y second #define sz size() #define eb emplace_back #define pb push_back vector<int> x[100001]; int used[100001]; int ok[100001]; int main(void){ int n, m, k, l; queue<int> q; cin >> n >> m; rep(i,n){ cin >> k; vector<int> tmp; rep(j,k){ cin >> l; tmp.push_back(l); } rep(j,k){ used[tmp[j]] = 1; rep(ij,j){ x[tmp[j]].push_back(tmp[ij]); x[tmp[ij]].push_back(tmp[j]); } } } q.push(l); while(!q.empty()){ int tp = q.front();q.pop(); rep(i,x[tp].size()){ if(!ok[x[tp][i]]){ ok[x[tp][i]] = 1; q.push(x[tp][i]); } } } rep(i,m){ if(ok[i] != used[i]){ cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | ichigo |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1205 Byte |
Status | WA |
Exec Time | 2144 ms |
Memory | 635516 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 | AC | 4 ms | 2560 KB |
01-02.txt | AC | 5 ms | 2688 KB |
01-03.txt | AC | 4 ms | 2560 KB |
01-04.txt | AC | 4 ms | 2560 KB |
01-05.txt | AC | 5 ms | 2560 KB |
01-06.txt | AC | 4 ms | 2560 KB |
01-07.txt | AC | 4 ms | 2560 KB |
01-08.txt | AC | 4 ms | 2560 KB |
01-09.txt | AC | 5 ms | 2560 KB |
01-10.txt | WA | 4 ms | 2560 KB |
02-01.txt | AC | 88 ms | 16128 KB |
02-02.txt | AC | 45 ms | 2688 KB |
02-03.txt | AC | 68 ms | 9472 KB |
02-04.txt | AC | 56 ms | 4864 KB |
02-05.txt | AC | 49 ms | 3200 KB |
02-06.txt | AC | 57 ms | 4864 KB |
02-07.txt | AC | 49 ms | 2944 KB |
02-08.txt | AC | 38 ms | 2560 KB |
02-09.txt | WA | 52 ms | 2560 KB |
02-10.txt | TLE | 2144 ms | 635516 KB |
02-11.txt | TLE | 2143 ms | 633852 KB |
02-12.txt | TLE | 2137 ms | 599040 KB |
02-13.txt | TLE | 2137 ms | 598784 KB |
sample-01.txt | AC | 5 ms | 2560 KB |
sample-02.txt | AC | 4 ms | 2560 KB |