南昌邀请赛 暴力模拟
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. struct Nod
  4. {
  5. int i;
  6. int a,b,c;
  7. } A[];
  8. bool f[];
  9. int B[][];
  10. bool cmp1(Nod a,Nod b)
  11. {
  12. return a.a<b.a;
  13. }
  14. bool cmp2(Nod a,Nod b)
  15. {
  16. return a.b<b.b;
  17. }
  18. bool cmp3(Nod a,Nod b)
  19. {
  20. return a.c<b.c;
  21. }
  22. int main()
  23. {
  24. int N,Q;
  25. scanf("%d%d",&N,&Q);
  26. int t;
  27. for(int i=; i<=N-; i++)
  28. {
  29. scanf("%d",&t);
  30. A[i].i=i+;
  31. A[i].a=t;
  32. }
  33. for(int i=; i<=N-; i++)
  34. {
  35. scanf("%d",&t);
  36. A[i].b=t;
  37. }
  38. for(int i=; i<=N-; i++)
  39. {
  40. scanf("%d",&t);
  41. A[i].c=t;
  42. }
  43. bool g=;
  44. sort(A,A+N,cmp1);
  45. f[A[N-].i]=;
  46. for(int i=; i<N; i++)
  47. {
  48. B[i][]=A[i].i;
  49. }
  50. sort(A,A+N,cmp2);
  51. f[A[N-].i]=;
  52. g=;
  53. for(int i=; i<N; i++)
  54. {
  55. B[i][]=A[i].i;
  56. if(f[A[i].i])
  57. {
  58. g=;
  59. }
  60. if(g&&f[A[i].i]==)
  61. {
  62. f[A[i].i]=;
  63. }
  64. }
  65. sort(A,A+N,cmp3);
  66. f[A[N-].i]=;
  67. g=;
  68. for(int i=; i<N; i++)
  69. {
  70. B[i][]=A[i].i;
  71. if(f[A[i].i])
  72. {
  73. g=;
  74. }
  75. if(g&&f[A[i].i]==)
  76. {
  77. f[A[i].i]=;
  78. }
  79. }
  80. while(true)
  81. {
  82. bool ch=;
  83. g=;
  84. for(int i=; i<N; i++)
  85. {
  86. if(f[B[i][]])
  87. {
  88. g=;
  89. }
  90. if(g&&f[B[i][]]==)
  91. {
  92. ch=;
  93. f[B[i][]]=;
  94. }
  95. }
  96. g=;
  97. for(int i=; i<N; i++)
  98. {
  99. if(f[B[i][]])
  100. {
  101. g=;
  102. }
  103. if(g&&f[B[i][]]==)
  104. {
  105. ch=;
  106. f[B[i][]]=;
  107. }
  108. }
  109. g=;
  110. for(int i=; i<N; i++)
  111. {
  112. if(f[B[i][]])
  113. {
  114. g=;
  115. }
  116. if(g&&f[B[i][]]==)
  117. {
  118. ch=;
  119. f[B[i][]]=;
  120. }
  121. }
  122. if(!ch)break;
  123. }
  124. while(Q--)
  125. {
  126. scanf("%d",&t);
  127. if(f[t])
  128. {
  129. puts("YES");
  130. }
  131. else puts("NO");
  132. }
  133. }

Winner的更多相关文章

  1. HDU 5754 Life Winner Bo 组合博弈

    Life Winner Bo Problem Description   Bo is a "Life Winner".He likes playing chessboard gam ...

  2. HDU 2509 Be the Winner nim博弈变形

    Be the Winner Problem Description   Let's consider m apples divided into n groups. Each group contai ...

  3. HDU5754 Life Winner Bo(博弈)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life Winner" ...

  4. Codeforces Beta Round #2 A. Winner

    A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...

  5. HDU2509 Be the Winner

    Be the Winner Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...

  6. 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 ...

  7. winner tree 胜者树

    在树形选择排序中,利用锦标赛思想建立的树称为胜者树. 1.每个非终端节点存储的是左右孩子节点中的优胜者. 2.通过减少比较次数,提高效率. 3.胜者树就是一颗特殊的线段树. 一.构建树 Procedu ...

  8. cf------(round 2)A. Winner

    A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...

  9. CrowdFlower Winner's Interview: 1st place, Chenglong Chen

    CrowdFlower Winner's Interview: 1st place, Chenglong Chen The Crowdflower Search Results Relevance c ...

  10. HDU 5754 Life Winner Bo (博弈)

    Life Winner Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life W ...

随机推荐

  1. tensorflow和keras的安装

    1 卸载tensorflow方法,在终端输入:  把protobuf删除了才能卸载干净. sudo pip uninstall protobuf sudo pip uninstall tensorfl ...

  2. java变量的类型

    变量的类型 一 按数据类型分: 1.基本数据类型 : 整型 : byte (1字节 -   (-128  ~  127)) short (2字节) int (4字节) long (8字节) 浮点型 : ...

  3. C89标准和C99标准C11标准的区别

    转载 C89标准和C99标准C11标准的区别 C99对C89的改变 1.增加restrict指针 C99中增加了公适用于指针的restrict类型修饰符,它是初始访问指针所指对象的惟一途径,因此只有借 ...

  4. 洛谷 - P3649 - 回文串 - 回文自动机

    https://www.luogu.org/problem/P3649 #include <bits/stdc++.h> using namespace std; typedef long ...

  5. Python2和Python3中的rang()不同之点

    知道在python中rang()是一个有序的列表,在使用过程发现,Python2和Python3中的rang()不同之点,下面讲述不同之点 1,Python2 rang()用法 ->> r ...

  6. CSS3实现小于1px的边框(移动端)

    <!doctype html> <html lang="en"> <head> <meta content="width=dev ...

  7. 06-File-文件

    文件 长久保存信息的一种数据信息集合 常用操作 打开关闭(文件一旦打开,需要关闭操作) 读写内容 查找 open函数 open函数负责打开文件,带有很多参数 第一个参数: 必须有,文件的路径和名称 m ...

  8. 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 ...

  9. IO流详解及测试代码

    IO流 (1)IO用于在设备间进行数据传输的操作 (2)分类:    A:流向       输入流 读取数据      输出流 写出数据   B:数据类型     字节流         字节输入流  ...

  10. python之流程控制升级

    python之流程控制:if elif else  while  for 一.流程控制之if: 1.1为什要有if判断:让计算机能像人一样代替人类工作,那么计算机应该有对于事务的读错,真假,是否可行的 ...