• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
HaibaraAi
博客园    首页    新随笔    联系   管理    订阅  订阅

Codeforce Round #217 Div2 B

B. Berland Bingo
time limit per test 1 second
memory limit per test 256 megabytes
 

Lately, a national version of a bingo game has become very popular in Berland. There are n players playing the game, each player has a card with numbers. The numbers on each card are distinct, but distinct cards can have equal numbers. The card of the i-th player contains mi numbers.

During the game the host takes numbered balls one by one from a bag. He reads the number aloud in a high and clear voice and then puts the ball away. All participants cross out the number if it occurs on their cards. The person who crosses out all numbers from his card first, wins. If multiple people cross out all numbers from their cards at the same time, there are no winners in the game. At the beginning of the game the bag contains 100 balls numbered 1 through 100, the numbers of all balls are distinct.

You are given the cards for each player. Write a program that determines whether a player can win the game at the most favorable for him scenario or not.

Input

The first line of the input contains integer n (1 ≤ n ≤ 100) — the number of the players. Then follow n lines, each line describes a player's card. The line that describes a card starts from integer mi (1 ≤ mi ≤ 100) that shows how many numbers the i-th player's card has. Then follows a sequence of integers ai, 1, ai, 2, ..., ai, mi (1 ≤ ai, k ≤ 100) — the numbers on the i-th player's card. The numbers in the lines are separated by single spaces.

It is guaranteed that all the numbers on each card are distinct.

Output

Print n lines, the i-th line must contain word "YES" (without the quotes), if the i-th player can win, and "NO" (without the quotes) otherwise.

Sample test(s)
Input
3 
1 1
3 2 4 1
2 10 11
Output
YES 
NO
YES
Input
2 
1 1
1 1
Output
NO 
NO
 1 #include <cstdio>
 2 #include <cmath>
 3 #include <vector>
 4 #include <stack>
 5 #include <cstring>
 6 #include <algorithm>
 7 using namespace std;
 8 #define maxn 1000
 9 #define INF 0x7fffffff
10 int n, m, k, x, y, d;
11 int a[maxn][maxn];
12 int main(){
13     scanf("%d", &n);
14     for (int i = 0; i < n; i++){
15         scanf("%d", &m);
16         for (int j = 0; j < m; j++){
17             scanf("%d", &x);
18             a[i][x] = 1;
19         }
20     }
21     for (int i = 0; i < n; i++){
22         int flag = 1;
23         for (int j = 0; j < n; j++)
24         if (i != j){
25             int t = 1;
26             for (int k = 1; k <= 100; k++)
27             if (!a[i][k] && a[j][k]){t = 0; break;}
28             if (t){ flag = 0; break; }
29         }
30         if (flag)printf("YES\n"); else printf("NO\n");
31     }
32     return 0;
33 }
View Code
posted @ 2013-12-07 21:21  HaibaraAi  阅读(116)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3