Winner
#include<bits/stdc++.h>
using namespace std;
struct Nod
{
int i;
int a,b,c;
} A[];
bool f[];
int B[][];
bool cmp1(Nod a,Nod b)
{
return a.a<b.a;
}
bool cmp2(Nod a,Nod b)
{
return a.b<b.b;
}
bool cmp3(Nod a,Nod b)
{
return a.c<b.c;
}
int main()
{
int N,Q;
scanf("%d%d",&N,&Q);
int t;
for(int i=; i<=N-; i++)
{
scanf("%d",&t);
A[i].i=i+;
A[i].a=t;
}
for(int i=; i<=N-; i++)
{
scanf("%d",&t);
A[i].b=t;
}
for(int i=; i<=N-; i++)
{
scanf("%d",&t);
A[i].c=t;
}
bool g=;
sort(A,A+N,cmp1);
f[A[N-].i]=;
for(int i=; i<N; i++)
{
B[i][]=A[i].i;
}
sort(A,A+N,cmp2);
f[A[N-].i]=;
g=;
for(int i=; i<N; i++)
{
B[i][]=A[i].i;
if(f[A[i].i])
{
g=;
}
if(g&&f[A[i].i]==)
{
f[A[i].i]=;
}
}
sort(A,A+N,cmp3);
f[A[N-].i]=;
g=;
for(int i=; i<N; i++)
{
B[i][]=A[i].i;
if(f[A[i].i])
{
g=;
}
if(g&&f[A[i].i]==)
{
f[A[i].i]=;
}
}
while(true)
{
bool ch=;
g=;
for(int i=; i<N; i++)
{
if(f[B[i][]])
{
g=;
}
if(g&&f[B[i][]]==)
{
ch=;
f[B[i][]]=;
}
}
g=;
for(int i=; i<N; i++)
{
if(f[B[i][]])
{
g=;
}
if(g&&f[B[i][]]==)
{
ch=;
f[B[i][]]=;
}
}
g=;
for(int i=; i<N; i++)
{
if(f[B[i][]])
{
g=;
}
if(g&&f[B[i][]]==)
{
ch=;
f[B[i][]]=;
}
}
if(!ch)break;
}
while(Q--)
{
scanf("%d",&t);
if(f[t])
{
puts("YES");
}
else puts("NO");
}
}
Winner的更多相关文章
- HDU 5754 Life Winner Bo 组合博弈
Life Winner Bo Problem Description Bo is a "Life Winner".He likes playing chessboard gam ...
- HDU 2509 Be the Winner nim博弈变形
Be the Winner Problem Description Let's consider m apples divided into n groups. Each group contai ...
- HDU5754 Life Winner Bo(博弈)
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life Winner" ...
- Codeforces Beta Round #2 A. Winner
A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...
- HDU2509 Be the Winner
Be the Winner Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- Recruit Coupon Purchase Winner's Interview: 2nd place, Halla Yang
Recruit Coupon Purchase Winner's Interview: 2nd place, Halla Yang Recruit Ponpare is Japan's leading ...
- winner tree 胜者树
在树形选择排序中,利用锦标赛思想建立的树称为胜者树. 1.每个非终端节点存储的是左右孩子节点中的优胜者. 2.通过减少比较次数,提高效率. 3.胜者树就是一颗特殊的线段树. 一.构建树 Procedu ...
- cf------(round 2)A. Winner
A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...
- CrowdFlower Winner's Interview: 1st place, Chenglong Chen
CrowdFlower Winner's Interview: 1st place, Chenglong Chen The Crowdflower Search Results Relevance c ...
- HDU 5754 Life Winner Bo (博弈)
Life Winner Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life W ...
随机推荐
- jmeter之分布式压测
很多性能大牛说一台机器的压测其实不准确,于是搜索网上的分布式压测练习了一番 目录 1.环境准备 2.控制机和压测机配置 3.执行分布式压测 1.环境准备 1.1准备一台windows作为控制机(mas ...
- BIN转换成HEX格式及HEX转换成BIN的两个函数接口
unsigned char HEX2BYTE(unsigned char hex_ch) { ') { '; } if (hex_ch >= 'a' && hex_ch < ...
- request.getParameter
request.getParameter(),该API针对的是 form表单entype的值为 application/x-www-form-urlencoded(默认值), 或者参数跟在地址栏上us ...
- netcore2.1 在后台运行一个任务
在 ASP.NET Core 2.1中, 提供了一个名为BackgroundService的类,在 Microsoft.Extensions.Hosting命名空间中,其代码为 namespace M ...
- OO第四单元总结及课程总结
OO第四单元总结及课程总结 一.前言 紧张刺激的OO“昆仑课程”接近尾声,经过一个学期的学习,我的收获和感触颇多,借此博客作业的机会,对自己OO这门课程做一个总结.本博客主要有以下五个方面,一是第UM ...
- Hibernate的HQL多表查询
HQL的内连接查询 对于HQL内链接查询,查询的是两张表的数据,这两张表的数据首先是保存在数组之中,然后在将每一个数组保存在List集合之中进行返回 代码片段: @Test // 内连接 public ...
- 时间、金钱在java、数据库中的变量类型之总结
在编写程序时,总是有些变量的类型搞不很明白,现将目前涉及到的变量总结一下: 1.“时间”类型 (1).在数据库中的变量类型是:DateTime 比如: operateTime DATETIME,//数 ...
- Django 数据库多字段同时关联一个表为外键的解决办法
多个字段对应一个外键时,会报错,如: class Storehouse_list(models.Model):#库位列表 nid = models.AutoField(primary_key=True ...
- 构造函数与new的汇编实现
this指针,通常是通过ecx传递:gcc是通过堆栈传递的,是最后一个被压栈.传递this指针是为了访问成员变量.除了虚函数,所有成员函数被编译之后都是全局函数.mov eax,[ecx] ; 将第一 ...
- Linux 修改hostname几种方式
1: hostname DB-Server --运行后立即生效(新会话生效),但是在系统重启后会丢失所做的修改 2: echo DB-Server > /proc/sys ...