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 ...
随机推荐
- tensorflow和keras的安装
1 卸载tensorflow方法,在终端输入: 把protobuf删除了才能卸载干净. sudo pip uninstall protobuf sudo pip uninstall tensorfl ...
- java变量的类型
变量的类型 一 按数据类型分: 1.基本数据类型 : 整型 : byte (1字节 - (-128 ~ 127)) short (2字节) int (4字节) long (8字节) 浮点型 : ...
- C89标准和C99标准C11标准的区别
转载 C89标准和C99标准C11标准的区别 C99对C89的改变 1.增加restrict指针 C99中增加了公适用于指针的restrict类型修饰符,它是初始访问指针所指对象的惟一途径,因此只有借 ...
- 洛谷 - P3649 - 回文串 - 回文自动机
https://www.luogu.org/problem/P3649 #include <bits/stdc++.h> using namespace std; typedef long ...
- Python2和Python3中的rang()不同之点
知道在python中rang()是一个有序的列表,在使用过程发现,Python2和Python3中的rang()不同之点,下面讲述不同之点 1,Python2 rang()用法 ->> r ...
- CSS3实现小于1px的边框(移动端)
<!doctype html> <html lang="en"> <head> <meta content="width=dev ...
- 06-File-文件
文件 长久保存信息的一种数据信息集合 常用操作 打开关闭(文件一旦打开,需要关闭操作) 读写内容 查找 open函数 open函数负责打开文件,带有很多参数 第一个参数: 必须有,文件的路径和名称 m ...
- Version Controlling with Git in Visual Studio Code and Azure DevOps
Overview Azure DevOps supports two types of version control, Git and Team Foundation Version Control ...
- IO流详解及测试代码
IO流 (1)IO用于在设备间进行数据传输的操作 (2)分类: A:流向 输入流 读取数据 输出流 写出数据 B:数据类型 字节流 字节输入流 ...
- python之流程控制升级
python之流程控制:if elif else while for 一.流程控制之if: 1.1为什要有if判断:让计算机能像人一样代替人类工作,那么计算机应该有对于事务的读错,真假,是否可行的 ...