Submission #3187535
Source Code Expand
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <math.h> #include <limits.h> int n,m,par[10000]; bool lang[10000][10000]; int find(int x){ if (par[x]==x){ return x; } else { return par[x]=find(par[x]); } } bool test(int x,int y){ for (int i=0; i<m; i++){ if (lang[x][i]==true && lang[y][i]==true){ return true; } } return false; } void unite(int x, int y){ x=find(x); y=find(y); if(x==y){ return ; } else { if (test(x,y)==true){ par[x]=y; for (int i=0; i<m; i++){ if (lang[x][i]==true){ lang[y][i]=true; } if (lang[y][i]==true){ lang[x][i]=true; } } } } } bool same(int x, int y){ if (find(x)==find(y)){ return true; } else { return false; } } int main(void){ scanf("%d%d",&n,&m); int k[n],l[n][m]; for (int i=0; i<n; i++){ scanf("%d",&k[i]); for (int j=0; j<k[i]; j++){ scanf("%d",&l[i][j]); l[i][j]--; lang[i][l[i][j]]=true; } } for (int i=0; i<n; i++){ par[i]=i; } for (int i=0; i<n-1; i++){ unite(i,i+1); } for (int i=0; i<n-1; i++){ unite(i,i+1); } for (int i=0; i<n-1; i++){ if (same(i,i+1)==false){ printf("No\n"); return 0 ; } } printf("Yes\n"); return 0 ; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | SpokenLib |
Language | C (Clang 3.8.0) |
Score | 0 |
Code Size | 1653 Byte |
Status | RE |
Exec Time | 117 ms |
Memory | 95872 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 | 128 KB |
01-02.txt | WA | 1 ms | 640 KB |
01-03.txt | WA | 5 ms | 13056 KB |
01-04.txt | WA | 2 ms | 9216 KB |
01-05.txt | WA | 3 ms | 9600 KB |
01-06.txt | WA | 3 ms | 7296 KB |
01-07.txt | WA | 2 ms | 6144 KB |
01-08.txt | WA | 4 ms | 7296 KB |
01-09.txt | WA | 3 ms | 6272 KB |
01-10.txt | WA | 5 ms | 13184 KB |
02-01.txt | RE | 96 ms | 128 KB |
02-02.txt | RE | 96 ms | 128 KB |
02-03.txt | RE | 96 ms | 128 KB |
02-04.txt | RE | 96 ms | 128 KB |
02-05.txt | RE | 96 ms | 128 KB |
02-06.txt | RE | 95 ms | 128 KB |
02-07.txt | RE | 96 ms | 128 KB |
02-08.txt | RE | 117 ms | 95872 KB |
02-09.txt | RE | 96 ms | 128 KB |
02-10.txt | RE | 96 ms | 128 KB |
02-11.txt | RE | 96 ms | 128 KB |
02-12.txt | RE | 96 ms | 128 KB |
02-13.txt | RE | 96 ms | 128 KB |
sample-01.txt | WA | 1 ms | 128 KB |
sample-02.txt | WA | 1 ms | 128 KB |