http://codeforces.com/gym/101149/problem/F

题目要输出最丑陋的衣服。所以每件衣服都要和其他衣服比一次。

但是注意到,能赢一件衣服的衣服,就算是好衣服了。

那么,可以选1做起始点,然后向后比较,如果后面的能赢比较点,那么这件就是好衣服了。

如果不能,那么证明起始点那件衣服是好衣服。当前这件衣服不确定,所以就重新选这件衣服做起吃点,去比较。

有可能会1赢7,7赢8但是8赢2这样,就是说可能要往前比较一次。

所以把数组写两次就可以了。

  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <cstring>
  4. #include <cmath>
  5. #include <algorithm>
  6. #define IOS ios::sync_with_stdio(false)
  7. using namespace std;
  8. #define inf (0x3f3f3f3f)
  9. typedef long long int LL;
  10.  
  11. #include <iostream>
  12. #include <sstream>
  13. #include <vector>
  14. #include <set>
  15. #include <map>
  16. #include <queue>
  17. #include <string>
  18. const int maxn = 2e5 + ;
  19. struct node {
  20. int a, b, c;
  21. bool operator == (const struct node & rhs) const {
  22. return a == rhs.a && b == rhs.b && c == rhs.c;
  23. }
  24. }arr[maxn * ];
  25. bool iswin[maxn * ];
  26. bool check(struct node a, struct node b) { //b打赢a
  27. if (b.a > a.a && b.b > a.b) return true;
  28. if (b.a > a.a && b.c > a.c) return true;
  29. if (b.b > a.b && b.c > a.c) return true;
  30. return false;
  31. }
  32. void work() {
  33. int n;
  34. cin >> n;
  35. for (int i = ; i <= n; ++i) {
  36. cin >> arr[i].a >> arr[i].b >> arr[i].c;
  37. arr[i + n] = arr[i];
  38. }
  39. int ans = ;
  40. struct node now = arr[];
  41. int id = ;
  42. for (int i = ; i <= * n; ++i) {
  43. if (now == arr[i]) continue;
  44. if (check(now, arr[i])) {
  45. iswin[i] = true;
  46. } else {
  47. iswin[id] = true;
  48. now = arr[i];
  49. id = i;
  50. }
  51. }
  52. for (int i = ; i <= n; ++i) {
  53. ans += iswin[i] == false;
  54. }
  55. cout << ans << endl;
  56. for (int i = ; i <= n; ++i) {
  57. if (iswin[i] == false) {
  58. cout << i << endl;
  59. }
  60. }
  61. }
  62.  
  63. int main() {
  64. #ifdef local
  65. freopen("data.txt","r",stdin);
  66. #endif
  67. IOS;
  68. work();
  69. return ;
  70. }

The Weakest Sith的更多相关文章

  1. 排序构造 GYM 101149 F - The Weakest Sith

    题目链接:http://codeforces.com/gym/101149/my 题目大意:给你n个人,他们有成绩a,b,c.一个人如果两门课比另外一个人高,那么这个人就比那个人厉害.问,是否存在一个 ...

  2. Educational Codeforces Round 13 E. Another Sith Tournament 概率dp+状压

    题目链接: 题目 E. Another Sith Tournament time limit per test2.5 seconds memory limit per test256 megabyte ...

  3. Educational Codeforces Round 13 E. Another Sith Tournament 状压dp

    E. Another Sith Tournament 题目连接: http://www.codeforces.com/contest/678/problem/E Description The rul ...

  4. Codeforces 678E. Another Sith Tournament(概率DP,状压)

    Codeforces 678E. Another Sith Tournament 题意: n(n<=18)个人打擂台赛,给定任意两人对决的胜负概率,比赛规则:可指定一人作为最开始的擂主,每次可指 ...

  5. codeforces 678E Another Sith Tournament 概率dp

    奉上官方题解 然后直接写的记忆化搜索 #include <cstdio> #include <iostream> #include <ctime> #include ...

  6. Codeforces 678E(Another Sith Tournament)

    题目链接:传送门 题目大意:有n个人决斗(n<=18),每两个人之间都有一定几率杀死对方,一次进行一次决斗,胜利者成为擂主继续接受决斗直到只剩下一个人,你是一号,问你最大有多大几率存活到最后. ...

  7. Codeforces 678E Another Sith Tournament 状压DP

    题意: 有\(n(n \leq 18)\)个人打擂台赛,编号从\(1\)到\(n\),主角是\(1\)号. 一开始主角先选一个擂主,和一个打擂的人. 两个人之中胜的人留下来当擂主等主角决定下一个人打擂 ...

  8. 十个免费的web应用安全检测工具

    Websites are getting more and more complex everyday and there are almost no static websites being bu ...

  9. CSS:CSS样式表及选择器优先级总结

    我们在写网页的时候经常会遇到同一个HTML文件,使用了外部样式.内部样式以及内联样式,那么如果发生冲突时浏览器是怎么抉择的呢? 也会遇到这样的情况,在样式表中,对同一个HTML元素,我们有可能既用到了 ...

随机推荐

  1. dtd文件中写的引用实体被xml文件引用后无法在浏览器中显示的问题

    解决方案:把dtd文件由被xml文件外部引用改成被xml文件内部引用. 例子: 1.xml文件: <?xml version="1.0" encoding="UTF ...

  2. RTree算法Java实现 JSI RTree Library的调用实例 标签:jsi-rtree-library

    1. [代码]jsi-rtree-library /** *  */package com.mycompany.project; //package net.sourceforge.jsi.examp ...

  3. linux应用之mysql数据库指定版本的yum安装(centos)

    A Quick Guide to Using the MySQL Yum Repository Abstract The MySQL Yum repository provides RPM packa ...

  4. linux系统配置之PATH环境变量的设置(centos)

    Centos系统下修改环境变量PATH路径的方法 电脑脑中必不可少的就是操作系统.而Linux的发展非常迅速,有赶超微软的趋势.这里介绍Linux的知识,让你学好应用Linux系统.比如要把/etc/ ...

  5. Java面向对象的三大特征详解

    一.封装(Encapsulation)       封装也称信息隐藏,是指利用抽象数据类型把数据和基于数据的操作封装起来,使其成为一个不可分割的整体,数据隐藏在抽象数据内部,尽可能的隐藏数据细节,只保 ...

  6. 最新版ADT(Build: v22.6.2)总是引用appcompat_v7的问题

    昨天在ADT Manager里更新了一些组件,结果ADT不支持.索性直接下载了最新的ADT.但是发现无论创建什么类型的应用(无论支持的最低API是多少,或者是不是用模板),都会在创建应用的同时创建一个 ...

  7. 洛谷P4092树——并查集

    题目:https://www.luogu.org/problemnew/show/P4092 利用并查集,倒序离线,那么从倒序来看被撤销标记的点就再也不会被标记,所以用并查集跳过: 莫名其妙的WA,调 ...

  8. HDU1171(01背包均分问题)

    Big Event in HDU Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u De ...

  9. js格式

    /** * Created by admin on 2017/9/22. */ // 分号后不要再有多余的空格 var name = "North"; var name = &qu ...

  10. bzoj4833

    $数论$ $这个题已经忘了怎么做了,也不想知道了,只记得看了3个小时$ $对于有gcd(f_i, f_j) = f_{gcd(i, j)}性质的数列,以下结论适用$ #include<bits/ ...