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 ...
随机推荐
- springboot 实现自定义注解
1.定义一个注解@Target(ElementType.METHOD)@Retention(RetentionPolicy.RUNTIME)@Documentedpublic @interface T ...
- [Leetcode] Path Sum II路径和
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...
- HDU 5666 快速乘
Segment Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Sub ...
- HDU1272:小希的迷宫(并查集)
小希的迷宫 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...
- 构建一个类jq的函数库
jqfree core var $ = function(selector, context) { return new $.fn.init(selector, context); }; $.fn = ...
- IOS 上传项目到github 终端操作
1.创建github账号 2.创建秘钥 3.Github配置秘钥 4.上传文件 复制保存网址 终端操作,如果没有ssh,自行安装 GitHub配置秘钥 克隆github上创建的项目 将自己的本地项目, ...
- es6+最佳入门实践(11)
11.async函数 async 函数是什么?一句话,它就是 Generator 函数的语法糖.通俗的说就是Generator函数的另一种写法,这种写法更简洁,除此之外,async函数还对Genrat ...
- 转:使用 Nginx Upload Module 实现上传文件功能
普通网站在实现文件上传功能的时候,一般是使用Python,Java等后端程序实现,比较麻烦.Nginx有一个Upload模块,可以非常简单的实现文件上传功能.此模块的原理是先把用户上传的文件保存到临时 ...
- Hadoop之yarn调用机制
1,Mapper方法:如果在map方法之前执行一些程序用setup,之后用cleanup.同理在Reducer方法中也有setup和cleanup. 2,map任务是并行执行,没有谁先谁后,如果是两个 ...
- RPC-Thrift(一)
一个简单例子 IDL文件如下,详细的IDL语法参考官方文档http://thrift.apache.org/docs/idl. 通过代码生成工具得到两个文件:HelloService.java和Res ...