[bitset] POJ 2443——Set Operation
来源:互联网 发布:几个程序员去吃饭 编辑:程序博客网 时间:2024/06/06 01:53
题目传送门
博主又来水blog啦
博主上一篇blog好像有提到这个bitset,其实那是博主并不是很懂,所以向Matchperson学习了这个操作。
题目概述
给定
在提出
解题思路
读入的时候标记一下,然后并起来判断有没有1。
所以就可以bitset乱搞。
bitset大法好啊。
#include<cstdio>#include<bitset>using namespace std;bitset<1005> s[10005];int n,Q;inline int _read(){ int num=0;char ch=getchar(); while (ch<'0'||ch>'9') ch=getchar(); while (ch>='0'&&ch<='9') num=num*10+ch-48,ch=getchar(); return num;}int main(){ freopen("exam.in","r",stdin); freopen("exam.out","w",stdout); n=_read(); for (int i=1;i<=n;i++){ int x=_read(); while (x--) s[_read()][i-1]=1; } Q=_read(); while(Q--){ int x=_read(),y=_read(); if ((s[x]&s[y]).any()) printf("Yes\n");else printf("No\n"); } return 0;}
阅读全文
0 0
- [bitset] POJ 2443——Set Operation
- poj 2443 Set Operation(bitset)
- POJ 2443 Set Operation -- 位运算 + bitset
- poj 2443 Set Operation (bitset用法
- 【bitset】POJ2443 Set Operation
- POJ 2443 Set Operation
- POJ 2443 Set Operation
- POJ 2443 Set Operation
- POJ2443:Set Operation(bitset)
- 【bitset】POJ2443[Set Operation]题解
- 压位加速-poj-2443-Set Operation
- poj 2443 Set Operation (位操作)
- poj 2443 Set Operation(思维&状态压缩)
- POJ -- 2443 Set Operation 【 二进制压位 】
- POJ 2443:Set Operation 经典位运算好题
- C++黑科技——bitset,set,map
- poj2443Set Operation (bitset)
- POJ 2443Set Operation(好题! 每32位压缩处理)
- 数据结构导论-第一章
- HTML5学习
- 机器学习笔记之代价函数(二)
- Scala--集合
- Html5笔记
- [bitset] POJ 2443——Set Operation
- 1282: 绝对值
- 事件对象_打印字符串_2线程_同步
- 1056: [HAOI2008]排名系统&1862: [Zjoi2006]GameZ游戏排名系统&codevs 1985
- maven报错:Non-resolvable parent POM for com.taotao:Taotao-common:0.0.1-SNAPSHOT: Could not find artifa
- hdu 5047 java大数+思维
- 多线程寻路
- 什么是注解以及运行时注解的使用
- c++学习笔记-----引用