http://codeforces.com/contest/370/problem/B

题意 :呃,这个题我说不清楚。。。。就是有n个人,第 i 个人手里有 mi 张牌,如果,现在主人念数,念到哪张牌谁就把哪张删掉,最后谁手里没有了谁就赢,如果同时没有了,两个人都输都输出no,最重要的是Write a program that determines whether a player can win the game at the most favorable for him scenario or not.这句话,意思是说每个人都按照每个人想要的哪种方式去念牌,根据样例,第一个人手里有1张牌,是1,第二个人手里有3张牌,分别是2 4 1,第三个人手里2张牌,分别是10和11,按照第一个人想自己赢的方式念牌,应该念1,所以他没有牌了,它可以赢,而对于第二个人来讲,无论怎么念,要么1赢他输,要么两个人全输,而对于第三个人来讲,先念10再念11就可以赢。

思路:这个题,挺坑的。。。。表示交了好几遍呢。。。。这个明白点就是找子集呢,如果第 i 个人手里的牌在第 j 个人手里全有,并且还有别的牌,那么第 i 个人就可以赢,而第 i 个人一定输,所以就是判断子集包含。。。。

#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std ;
bool contains(vector<int>a,vector<int>b)//b in a?
{
for(int i = ; i < b.size() ; i++)
{
bool in = false ;
for(int j = ; j < a.size() ; j++)
{
if(a[j] == b[i])
in = true ;
}
if(!in)
return false ;
}
return true ;
}
int main()
{
int n ;
vector<int>a[] ;
while(~scanf("%d",&n))
{
int m,h ;
for(int i = ; i < n ; i++)
{
scanf("%d",&m) ;
a[i].clear() ;
for(int j = ; j < m ; j++)
{
scanf("%d",&h) ;
a[i].push_back(h) ;
}
}
int flag[];
for(int i = ; i < ; i++)
flag[i] = ;
for(int i = ; i < n ; i++)
{
for(int j = ; j < n ; j++)
{
if(i==j) continue;
if(contains(a[j],a[i]))
{
flag[j] = ;
if(a[i].size() == a[j].size())
flag[i] = ;
}
}
}
for(int i = ; i < n ; i++)
if(flag[i]) cout<<"YES"<<endl;
else cout<<"NO"<<endl ;
}
return ;
}

这个是二师兄写的非vector 的

#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <string>
#define M 10010
#define INF 1 << 30; using namespace std; int f[][];
int main()
{
int n, i, j, m[M], k, t;
int dp[];
memset(dp , , sizeof(dp));
cin >>n;
for(i = ; i < n; i++)
{
cin >>m[i];
for(j = ; j < m[i]; j++)
cin >>f[i][j];
sort(f[i], f[i]+m[i]);
}
for(i = ; i < n-; i++)
{
for(j = i+; j < n; j++)
{
if(m[i] >= m[j])
{
t = ;
for(k = ; k < m[i]; k++)
{
if(f[i][k] == f[j][t])
t++;
}
if(t >= m[j])
dp[i] = ;
if(m[j] == m[i] && t >= m[j])
dp[j] = ;
}
else
{
t = ;
for(k = ; k < m[j]; k++)
if(f[i][t] == f[j][k])
t++;
if(t >= m[i])
dp[j] = ;
}
}
}
for(i = ; i < n; i++)
{
if(!dp[i])
cout <<"YES"<<endl;
else
cout <<"NO"<<endl;
}
return ;
}

CF 217 B. Berland Bingo的更多相关文章

  1. CF 370B Berland Bingo

    题目链接: 传送门 Berland Bingo time limit per test:1 second     memory limit per test:256 megabytes Descrip ...

  2. cf B. Berland Bingo

    http://codeforces.com/contest/370/problem/B 题意:给你n个卡片,卡片上有m个不同的数字,这个游戏是随即的从袋子里面抽球,球上有数字1-100:如果第ith玩 ...

  3. B. Berland Bingo

    Lately, a national version of a bingo game has become very popular in Berland. There are n players p ...

  4. Edu Cf Round 105 (Div. 2) B. Berland Crossword 1.读懂题, 2. 思维

    一. 原题链接 https://codeforces.com/contest/1494/problem/B   二. 题意 + 题解: 没看懂题目, 懵了好久, 先狡辩一下当时误解的句子, 英语是硬伤 ...

  5. CF #375 (Div. 2) D. bfs

    1.CF #375 (Div. 2)  D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...

  6. [CF1005F]Berland and the Shortest Paths_最短路树_堆优化dij

    Berland and the Shortest Paths 题目链接:https://www.codeforces.com/contest/1005/problem/F 数据范围:略. 题解: 太鬼 ...

  7. ATC/TC/CF

    10.25 去打 CF,然后被 CF 打了. CF EDU 75 A. Broken Keyboard 精神恍惚,WA 了一发. B. Binary Palindromes 比赛中的憨憨做法,考虑一个 ...

  8. CF round #622 (div2)

    CF Round 622 div2 A.简单模拟 B.数学 题意: 某人A参加一个比赛,共n人参加,有两轮,给定这两轮的名次x,y,总排名记为两轮排名和x+y,此值越小名次越前,并且对于与A同分者而言 ...

  9. ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'

    凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...

随机推荐

  1. 关于datalist

    http://www.cnblogs.com/shipfi/archive/2009/10/19/1585705.html

  2. PeopleReady 是什么系统?其中文为全员就绪

    PeopleReady 中文:全员就绪. 顾名思义: 一句话:PeopleReady 就是能使人快速Ready的系统. 稍长一句话:就是能使大家快速Ready(经验+知识)的系统. 详细的来说:通过积 ...

  3. The Shapes of CSS

    #square { width: 100px; height: 100px; background: red; } #rectangle { width: 200px; height: 100px; ...

  4. ionic+cordova+angularJs监听刷新

    普通的js返回并刷新这里就不多说了,百度就有很多方法. 下面说的是使用了angularjs.ionic开发的一个手机app中我使用的返回上一页并刷新的方法. 场景:回复的页面是单独的,点击保存回复后会 ...

  5. java多线程总结四:volatile、synchronized示例

    1.synchronized保证同步 先看一个生成偶数的类 <span style="font-size:16px;">package demo.thread; /** ...

  6. Appium Android 屏幕滑动

  7. html-----017

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. 关于$.fn

    今天看一篇文章,里面的一段代码出现了$.fn,第一次见到这样的写法,于是跑去问度娘...代码如下: $.fn.scrollUnique = function() { return $(this).ea ...

  9. [DevExpress]SplitContainerControl使用小计

    1.修改成纵向分割 Horizontal = false; 2.设置伸缩箭头 3.固定某个PANEL大小 最大化后依然保持着比例 4.隐藏某个PANEL splitContainerControl1. ...

  10. [转] Js获取 本周、本月、本季度、本年、上月、上周、上季度、去年时间段

    /** * 针对时间的工具类 */ var DateTimeUtil = function () { /*** * 获得当前时间 */ this.getCurrentDate = function ( ...