1957 Problem F 乌鸦坐飞机
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
#pragma warning(disable:4996)
using namespace std; int a[32][10001];
int n,q; int main()
{
int i,j,f,h,k,num;
bool flag;
memset(a,0,sizeof(0));
while(~scanf("%d",&n))
{
for(i=1;i<=n;i++)
{
scanf("%d",&f);
h=i%32;
k=i/32;
for(j=1;j<=f;j++)
{
scanf("%d",&num);
a[h][num] = a[h][num]|(1<<k);
}
}
scanf("%d",&q);
for(i=1;i<=q;i++)
{
scanf("%d%d",&h,&k);
flag=false;
for(j=0;j<32;j++)
{
if(a[j][h]&a[j][k])
{
flag=true;
break;
}
}
if(flag)
printf("Yes\n");
else
printf("No\n");
} }
return 0;
}
1957 Problem F 乌鸦坐飞机的更多相关文章
- 几何入门合集 gym101968 problem F. Mirror + gym102082 Problem F Fair Chocolate-Cutting + gym101915 problem B. Ali and Wi-Fi
abstract: V const & a 加速 F. Mirror 题意 链接 问题: 有n个人在y=0的平面上(及xoz平面).z=0平面上有一面镜子(边平行于坐标轴).z=a平面上有q个 ...
- 2019 ICPC 银川网络赛 D. Take Your Seat (疯子坐飞机问题)
Duha decided to have a trip to Singapore by plane. The airplane had nn seats numbered from 11 to nn, ...
- 用自己赚的钱第一次坐飞机 那feel倍儿爽
马年春晚上,歌手大张伟的神曲<倍儿爽>如今已传遍大街小巷.其实,不管人家到底有没有炒作,能让我们这些观众感觉到放松.乐呵,那就是一个成功的春晚节目.而今年,我也如同这歌中唱的一样,活得倍儿 ...
- 实验12:Problem F: 求平均年龄
Home Web Board ProblemSet Standing Status Statistics Problem F: 求平均年龄 Problem F: 求平均年龄 Time Limit: ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem F
Problem F Funny Car Racing There is a funny car racing in a city with n junctions and m directed roa ...
- Codeforces Gym 100500F Problem F. Door Lock 二分
Problem F. Door LockTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/at ...
- Codeforces Gym 100002 Problem F "Folding" 区间DP
Problem F "Folding" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/ ...
- Codeforces Gym 100286F Problem F. Fibonacci System 数位DP
Problem F. Fibonacci SystemTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudg ...
- Problem F: Exponentiation
Problem F: ExponentiationTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 4 Solved: 2[Submit][Status][W ...
随机推荐
- Netscaler重置密码的方法
Netscaler重置密码的方法 http://blog.51cto.com/caojin/1898401 有时候我们会碰到忘记Netscaler的密码,或接手别人的设备而不知道密码的情况.在这种情况 ...
- 【考试记录】4.8 Table ( 数论数学 --组合数 & 杨辉三角)
陆陆续续的开始考很多的试,也会更新这些题目记录下来,免得做完了之后毫无印象,就这么水过去了(以前的考试都是如此,哎……) Table (T1) : 样例: 出于对数学题本能的恐惧考场上放弃了此题专攻T ...
- CCmdUI
原文链接地址:http://blog.csdn.net/luicha/article/details/6771185 CCmdUI是一个只被使用于ON_UPDATECOMMAND_UI消息的响应函数中 ...
- 遇到问题---java---git下载的maven项目web用tomcat发布时不带子项目
遇到的情况是用git下载maven项目,然后用mvn eclipse:eclipse命令标记为eclipse项目之后,使用maven插件导入之后用tomcat发布运行,发现maven关联的几个子项目没 ...
- jQuery.getJSON跨域访问的正确使用方式(史上最傻瓜式解释)
最近花了2天时间完整的看了一遍 jQuery 的API,其中 $.getJSON(url[, data][, callback]) 方法的跨域访问解释真心看的一头雾水,大家可以从这里感受一下: htt ...
- Codeforces Round #525 (Div. 2)D. Ehab and another another xor problem
D. Ehab and another another xor problem 题目链接:https://codeforces.com/contest/1088/problem/D Descripti ...
- 解析json方式之net.sf.json
前面转载了json解析的技术:fastjson,今天说下另外一种技术. 下载地址 本次使用版本:http://sourceforge.net/projects/json-lib/files/json- ...
- Terminals Project
https://github.com/Terminals-Origin Terminals Project Terminals is a secure, multi tab terminal serv ...
- Awk basic and practice
定义:Awk是一种程序语言,用来处理数据和产生报告.数据可来自标准输入,文件,管道输出. 格式:#awk '/pattern/ {action}' filename 术语:pattern, 样式是由正 ...
- LABVIEW伺服电机测试平台
遇见的关键问题总结: 怎么发脉冲:(1)保持电平一段时间进行翻转(2)仿真脉冲 怎样测试脉冲数:通过检测当前时刻和前一时刻的电平是否相同(通过反馈或者移位寄存器实现)来检测脉冲跳变 通过编码器测量速度 ...