CodeForces Round #145(234D) - Cinema
来源:互联网 发布:ci框架连接数据库 编辑:程序博客网 时间:2024/06/05 04:35
算出每个演出的可能最少喜欢演员人数MIN,和可能最多喜欢演员人数MAX...对于一个演出来说若其MIN不小于其他所有演出的MAX..则其为surely be the favourite...若其MAX不大于其他所有演出的MIN,则其为won't surely be the favourite...都不满足..只能是can either be favourite, or not favourite
Program:
#include<iostream>#include<stdio.h>#include<string.h>#include<cmath>#include<algorithm>#include<stack>#include<queue>#include<set>#define ll long longusing namespace std;struct node{ int MAX,MIN;}c[105];int m,n,num,k,x,a[105];bool f[105];char s[25];int main(){ freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); int i,j,n1,n2,nn,h; while (~scanf("%d%d",&m,&k)) { memset(f,false,sizeof(f)); for (i=1;i<=k;i++) { scanf("%d",&j); f[j]=true; } scanf("%d",&n); for (i=1;i<=n;i++) { scanf("%s%d",s,&num); n1=k,n2=m-k,h=nn=0; for (j=1;j<=num;j++) { scanf("%d",&x); if (!x) nn++; else if (f[x]) h++,n1--; else n2--; } if (n1>=nn) c[i].MAX=h+nn; else c[i].MAX=h+n1; if (n2>=nn) c[i].MIN=h; else c[i].MIN=h+nn-n2; } for (i=1;i<=n;i++) { for (j=1;j<=n;j++) if (j!=i && c[j].MAX>c[i].MIN) break; if (j>n) printf("0\n"); else { for (j=1;j<=n;j++) if (j!=i && c[j].MIN>c[i].MAX) break; if (j<=n) printf("1\n"); else printf("2\n"); } } } return 0;}
- CodeForces Round #145(234D) - Cinema
- Codeforces 234D Cinema
- 234D-cinema 水题被卡
- CodeForces Round #223 div.1 D.Sereja and Cinema(组合计数)
- Codeforces Round #350 (Div. 2) C Cinema
- Codeforces Round #350 (Div. 2) C. Cinema
- Codeforces Round 380 C. Road to Cinema
- codeforces 82D Cinema Cashier dp 队列
- Codeforces 380D Sereja and Cinema
- Codeforces Round #449 (Div. 1) D. Nephren Runs a Cinema 卡特兰数,逆元,欧拉函数,
- Cinema CodeForces
- Cinema CodeForces
- Codeforces Beta Round #10 B. Cinema Cashier (树状数组)
- Codeforces Round #380 (Div. 2)C. Road to Cinema
- Codeforces Round #380 (Div. 2) C. Road to Cinema 二分
- Codeforces Round#213D
- Codeforces Round#131D
- Codeforces Round 341D
- 网站HTTP状态码
- hadoop-eclipse开发环境搭建及error: failure to login错误
- cocos2d-x eclipse android 配置注意项(笔记)
- 经常用Linux 但是你知道它和Unix区别吗
- 【读书笔记】《大数据——互联网大规模数据挖掘与分布式处理》
- CodeForces Round #145(234D) - Cinema
- 分析腾讯微博登录过程
- 临界区,互斥量,信号量,事件的区别
- CodeForces Round #145(234E) - Champions' League
- C#(asp.net)读取yodao提供的ip地址库接口查询IP地址
- 俄罗斯独特的职业黑客文化
- Linux下patch的制作和应用
- CodeForces Round #145(234F) - Fence
- 使用Android手机制作的语音控制坦克,很有创意