Submission #1112098
Source Code Expand
#include<bits/stdc++.h> #define FOR(i, a, b) for(int(i)=(a);(i)<(b);(i)++) #define REP(i, n) FOR((i), 0, (n)) #define RFOR(i, b, a) for(int(i)=(b); (i)>=(a); (i)--) #define RREP(i, n) FOR((i), (n), 0) #define pb push_back #define mp make_pair using namespace std; const int INF=INT_MAX/4; const int MOD=1000000007; const double EPS=1e-14; const bool debug_flag=true; void debug(string str){ if(debug_flag){ cout<<str<<endl; } } void debugs(string str){ if(debug_flag){ cout<<str; } } vector < int > p; int k; int parent(int a){ if(p[a]<0)return a; return p[a]=parent(p[a]); } void myunion(int a, int b){ a=parent(a); b=parent(b); if(a!=b){ if(p[a] > p[b]){ int tmp=a; a=b; b=tmp; } p[a]+=p[b]; p[b]=a; k--; } } int main(int argc, char* argv[]){ cin.tie(0); ios::sync_with_stdio(0); cout.precision(10); int n, m; int a, b, l; cin>>n>>m; p.resize(m); vector<bool> used(m); k=m; REP(i, m){ p[i]=-1; } REP(i, n){ cin>>l; cin>>a; used[a-1]=true; FOR(j, 1, l){ cin>>b; used[b-1]=true; myunion(a, b); a=b; } } int cnt=0; REP(i, m){ if(!used[i]){ cnt++; } } if(k==cnt+1){ cout<<"Yes"<<endl; }else{ cout<<"No"<<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | tata |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1328 Byte |
Status | RE |
Exec Time | 99 ms |
Memory | 640 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, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | WA | 1 ms | 256 KB |
01-02.txt | WA | 1 ms | 256 KB |
01-03.txt | WA | 1 ms | 256 KB |
01-04.txt | WA | 1 ms | 256 KB |
01-05.txt | WA | 1 ms | 256 KB |
01-06.txt | WA | 1 ms | 256 KB |
01-07.txt | WA | 1 ms | 256 KB |
01-08.txt | WA | 1 ms | 256 KB |
01-09.txt | WA | 1 ms | 256 KB |
01-10.txt | WA | 1 ms | 256 KB |
02-01.txt | WA | 11 ms | 640 KB |
02-02.txt | WA | 13 ms | 256 KB |
02-03.txt | WA | 11 ms | 512 KB |
02-04.txt | WA | 14 ms | 640 KB |
02-05.txt | WA | 13 ms | 256 KB |
02-06.txt | WA | 14 ms | 640 KB |
02-07.txt | WA | 14 ms | 256 KB |
02-08.txt | WA | 12 ms | 256 KB |
02-09.txt | WA | 15 ms | 640 KB |
02-10.txt | WA | 12 ms | 512 KB |
02-11.txt | WA | 12 ms | 512 KB |
02-12.txt | WA | 12 ms | 512 KB |
02-13.txt | WA | 12 ms | 512 KB |
sample-01.txt | RE | 99 ms | 256 KB |
sample-02.txt | WA | 1 ms | 256 KB |