【题目链接】:http://codeforces.com/contest/787/problem/B

【题意】



…水题。。题目太吓人

【题解】



只要你在一组里面找到两个数字,它们的绝对值相同,但是正负性相反,那么就可以确定,这一组

里面最少不会全是间谍.

知道这个之后只要贪心一下就好;

遇到一个组里面有互为相反数的,这个组就ok;

如果有一个组没有,就返回false;



【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rei(x) scanf("%d",&x)
#define rel(x) scanf("%lld",&x)
#define ref(x) scanf("%lf",&x) typedef pair<int,int> pii;
typedef pair<LL,LL> pll; const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110; int n,m;
map <int,int> dic; void in()
{
rei(n),rei(m);
} bool get_ans()
{
rep1(i,1,m)
{
int k,x;
bool ju = false;
rei(k);
dic.clear();
rep1(j,1,k)
{
rei(x);
if (dic[-x])
ju = true;
dic[x] = 1;
}
if (!ju)
return false;
}
return true;
} int main()
{
//freopen("F:\\rush.txt","r",stdin);
in();
if (get_ans())
puts("NO");
else
puts("YES");
//printf("\n%.2lf sec \n", (double)clock() / CLOCKS_PER_SEC);
return 0;
}

【codeforces 787B】Not Afraid的更多相关文章

  1. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  2. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  3. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  4. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

  5. 【codeforces 709B】Checkpoints

    [题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...

  6. 【codeforces 709C】Letters Cyclic Shift

    [题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...

  7. 【Codeforces 429D】 Tricky Function

    [题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...

  8. 【Codeforces 670C】 Cinema

    [题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...

  9. 【codeforces 515D】Drazil and Tiles

    [题目链接]:http://codeforces.com/contest/515/problem/D [题意] 给你一个n*m的格子; 然后让你用1*2的长方形去填格子的空缺; 如果有填满的方案且方案 ...

随机推荐

  1. 原生js大总结五

    041.在js中如何用方法将10进制的字符转换成16进制和8进制   数字.toString(16) 数字.toString(8)     042.如何创建时间对象   new Date()   04 ...

  2. Keepalived + Mysql 双主

    VIP 192.168.1.41 Master 192.168.1.42 Slave 192.168.1.43 .配置 yum -y install mysql-server chkconfig -- ...

  3. 2018VMware虚拟机安装Mac OS 10.12.1

    说明:该篇博客是博主一字一码编写的,实属不易,请尊重原创,谢谢大家! 一.下载安装中所需的镜像文件以及补丁工具 Mac OS 10.12.1 Sierra (16B2555) 懒人版(下载地址):ht ...

  4. ehcache、memcache、redis三大缓存比较(转)

    最近项目组有用到这三个缓存,去各自的官方看了下,觉得还真的各有千秋!今天特意归纳下各个缓存的优缺点,仅供参考!  Ehcache 在Java项目广泛的使用.它是一个开源的.设计于提高在数据从RDBMS ...

  5. [Android 4.4.2] 泛泰A870 Mokee4.4.2 20140531 RC1.0 by syhost

    欢迎关注泛泰非盈利专业第三方开发团队 VegaDevTeam  (本team 由 syhost suky zhaochengw(z大) xuefy(大星星) tenfar(R大师) loogeo cr ...

  6. xxxyyy

    https://www.gaojinan.com/vps-o p e n v p n-china-telecom-unicom-mobile-mianliu-ml.html

  7. sqlplus中怎么将你全部的操作和结果记录保存到你指定的文件里

    [在sqlplus的操作中,非常多时候我们都想把自己的写的sql语句和改动日志或者结果信息做记录] [首先]肯定要正常连接到oralce数据库. [然后] 你用你指定的用户登录到oralce数据库之后 ...

  8. WCF走你~异常篇(永久更新...)

    下面是我个人在进行WCF开发时,遇到的问题及相关的解决方法,供大家一起学习 1. ......HTTP 响应时发生错误.这可能是由于服务终结点绑定未使用 HTTP 协议造成的. 解决:把返回的实体类添 ...

  9. 【TP SRM 703 div2 500】 GCDGraph

    Problem Statement You are given four ints: n, k, x, and y. The ints n and k describe a simple undire ...

  10. [Recompose] Flatten a Prop using Recompose

    Learn how to use the ‘flattenProp’ higher order component to take a single object prop and spread ea ...