codeforces 868C
来源:互联网 发布:淘宝情趣用品类目 编辑:程序博客网 时间:2024/06/05 09:11
题目链接:
http://codeforces.com/problemset/problem/868/C
题解:
离散化后,只要确定有一对满足条件就行了,但是需要注意只有一个的特殊情况。
代码:
#include <map>#include <cmath>#include <queue>#include <vector>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;#define inf 0x3f3f3f3f#define met(a,b) memset(a,b,sizeof(a))vector<vector<int> >pp;map<int,int>mp;int main(){ int n,k; scanf("%d%d",&n,&k); vector<int>p; mp.clear(); pp.clear(); for(int i=0;i<n;i++) { int ans=0; p.clear(); for(int j=0;j<k;j++) { int x; scanf("%d",&x); ans=ans*2+x; p.push_back(x); } if(!mp[ans]) { pp.push_back(p); mp[ans]++; } } bool flag=false; for(int k1=0;k1<pp.size();k1++) { for(int k2=0;k2<pp.size();k2++) { flag=false; for(int len=0;len<k;len++) { if(pp[k1][len]==pp[k2][len]&&pp[k1][len]&&pp[k2][len]) { flag=true; break; } } if(!flag) { printf("YES\n"); return 0; } } } printf("NO\n");}
阅读全文
0 0
- Codeforces-868C
- codeforces 868C
- Codeforces 868C
- Codeforces 868 C Qualification Rounds
- codeforces 868C Qualification Rounds
- codeforces 868C Qualification Rounds
- Codeforces 868C Qualification Rounds
- Codeforces 868C Qualification Rounds
- CodeForces 868C Qualification Rounds
- codeforces 868C Qualification Rounds
- codeforces 868c(二进制)
- Codeforces 868 C. Qualification Rounds (技巧)
- Codeforces Round #438 868A/B/C
- Codeforces 868C Qualification Rounds【思维】
- Codeforces 868C Qualification Rounds 结论
- Codeforces-868B ,C 模拟,思维。。
- Codeforces-340-C(c++)
- Codeforces-507-C(c++)
- 补墙
- Oracle---逻辑备份
- Qt 学习之路 2(65):访问网络(1)
- 请输入一个数,计算其二进制中1的个数
- 一端口发送一端口接收socket编程
- codeforces 868C
- &(与运算)、|(或运算)、^(异或运算)的本质理解
- Linux的常用指令(一)
- Oracle PL/SQL小练习
- 树形DP 总结
- 变量、数据与数组操作
- $.Deferred()的promise()方法-学习笔记
- 数据结构——第四讲、树(中)(2)
- Codeforces Round #438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined)C