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

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

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

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

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

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

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

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL; #include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
const int maxn = 2e5 + ;
struct node {
int a, b, c;
bool operator == (const struct node & rhs) const {
return a == rhs.a && b == rhs.b && c == rhs.c;
}
}arr[maxn * ];
bool iswin[maxn * ];
bool check(struct node a, struct node b) { //b打赢a
if (b.a > a.a && b.b > a.b) return true;
if (b.a > a.a && b.c > a.c) return true;
if (b.b > a.b && b.c > a.c) return true;
return false;
}
void work() {
int n;
cin >> n;
for (int i = ; i <= n; ++i) {
cin >> arr[i].a >> arr[i].b >> arr[i].c;
arr[i + n] = arr[i];
}
int ans = ;
struct node now = arr[];
int id = ;
for (int i = ; i <= * n; ++i) {
if (now == arr[i]) continue;
if (check(now, arr[i])) {
iswin[i] = true;
} else {
iswin[id] = true;
now = arr[i];
id = i;
}
}
for (int i = ; i <= n; ++i) {
ans += iswin[i] == false;
}
cout << ans << endl;
for (int i = ; i <= n; ++i) {
if (iswin[i] == false) {
cout << i << endl;
}
}
} int main() {
#ifdef local
freopen("data.txt","r",stdin);
#endif
IOS;
work();
return ;
}

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. hibernate入门(-)

    1.struts2的支持 在web.xml中配置struts2的支持 <?xml version="1.0" encoding="UTF-8"?> ...

  2. June 26,程序破解

    1.android程序破解练习初级 方法一: 文件名:KeygenMe#1.apk工具:ApktoolGui v2.0 Final 先用ApktoolGui v2.0 Final反编译成java通过查 ...

  3. 「LuoguP1220」 关路灯(区间dp

    题目描述 某一村庄在一条路线上安装了n盏路灯,每盏灯的功率有大有小(即同一段时间内消耗的电量有多有少).老张就住在这条路中间某一路灯旁,他有一项工作就是每天早上天亮时一盏一盏地关掉这些路灯. 为了给村 ...

  4. Tensorflow基础知识

    基本知识 使用 TensorFlow, 你必须明白 TensorFlow: 使用图 (graph) 来表示计算任务. 在被称之为 会话 (Session) 的上下文 (context) 中执行图. 使 ...

  5. ubuntu16.04 跑Apollo Demo

    1.安装docker(参考网址:https://docs.docker.com/install/linux/docker-ce/ubuntu/) Uninstall old versions Olde ...

  6. Adventure Works 教程

    多维建模(Adventure Works 教程)     欢迎使用 Analysis Services 教程. 本教程通过在所有示例中使用虚构公司 Adventure Works Cycles,说明如 ...

  7. Git(一)

    Git概念 Git其实是一种分布式版本控制系统,与CVS,Subversion等集中化的版本控制系统相对.它主要有几个特点: • 速度快 • 简单的设计 • 对非线性开发模式的强力支持(允许上千个并行 ...

  8. UVaLive 3971 Assemble (水题二分+贪心)

    题意:你有b元钱,有n个配件,每个配件有各类,品质因子,价格,要每种买一个,让最差的品质因子尽量大. 析:很简单的一个二分题,二分品质因子即可,每次计算要花的钱的多少,每次尽量买便宜且大的品质因子. ...

  9. Android教程

    转载,但请务必在明确位置注明出处! http://stormzhang.com/android/2014/07/07/learn-android-from-rookie/ Android Killer ...

  10. lightoj1047 【简单线性DP】

    因为写不出hdu3401...好像要用单调队列优化...这边水了一个... 题意: 给n个房子涂色,给出n个房子对应颜色的花费,问涂完所有颜色花费最少. 保证相邻房子颜色不能相同. 思路: dp[i] ...