The Weakest Sith
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的更多相关文章
- 排序构造 GYM 101149 F - The Weakest Sith
题目链接:http://codeforces.com/gym/101149/my 题目大意:给你n个人,他们有成绩a,b,c.一个人如果两门课比另外一个人高,那么这个人就比那个人厉害.问,是否存在一个 ...
- Educational Codeforces Round 13 E. Another Sith Tournament 概率dp+状压
题目链接: 题目 E. Another Sith Tournament time limit per test2.5 seconds memory limit per test256 megabyte ...
- Educational Codeforces Round 13 E. Another Sith Tournament 状压dp
E. Another Sith Tournament 题目连接: http://www.codeforces.com/contest/678/problem/E Description The rul ...
- Codeforces 678E. Another Sith Tournament(概率DP,状压)
Codeforces 678E. Another Sith Tournament 题意: n(n<=18)个人打擂台赛,给定任意两人对决的胜负概率,比赛规则:可指定一人作为最开始的擂主,每次可指 ...
- codeforces 678E Another Sith Tournament 概率dp
奉上官方题解 然后直接写的记忆化搜索 #include <cstdio> #include <iostream> #include <ctime> #include ...
- Codeforces 678E(Another Sith Tournament)
题目链接:传送门 题目大意:有n个人决斗(n<=18),每两个人之间都有一定几率杀死对方,一次进行一次决斗,胜利者成为擂主继续接受决斗直到只剩下一个人,你是一号,问你最大有多大几率存活到最后. ...
- Codeforces 678E Another Sith Tournament 状压DP
题意: 有\(n(n \leq 18)\)个人打擂台赛,编号从\(1\)到\(n\),主角是\(1\)号. 一开始主角先选一个擂主,和一个打擂的人. 两个人之中胜的人留下来当擂主等主角决定下一个人打擂 ...
- 十个免费的web应用安全检测工具
Websites are getting more and more complex everyday and there are almost no static websites being bu ...
- CSS:CSS样式表及选择器优先级总结
我们在写网页的时候经常会遇到同一个HTML文件,使用了外部样式.内部样式以及内联样式,那么如果发生冲突时浏览器是怎么抉择的呢? 也会遇到这样的情况,在样式表中,对同一个HTML元素,我们有可能既用到了 ...
随机推荐
- UEBA——通过用户画像识别安全威胁
UEBA and Machine Learning - Download Free Guide for CISOs Adinfo.niara.com/UEBA/Guide-For-CISOs Le ...
- MFC中显示一张位图
1.用类CBitmap加载位图 2.创建内存DC, 将位图选进此内存DC 3.调用BitBlt将内存DC的内容拷贝到其它DC(通知是显示DC) 例子(来自MSDN): // This OnDraw() ...
- nginx开发_Filter模块执行顺序
Filter模块执行顺序 Filter模块的执行顺序是在执行configure文件时决定的,configure文件执行完成后生成objs/ngx_modules.c,文件中定义了一个数组ngx_mod ...
- C++类对象之间的类型转换和重载
类对象和其他类型对象的转换 转换场合有: 赋值转换 表达式中的转换 显式转换 函数调用, 传递参数时的转换 转换方向有: 由定义类向其他类型的转换 由其他类型向定义类的转换 #include < ...
- C++之引用&的详解
C++中的引用: 引用引入了对象的一个同义词.定义引用的表示方法与定义指针相似,只是用&代替了*.引用(reference)是c++对c语言的重要扩充.引用就是某一变量(目标)的一个别名,对引 ...
- AQS共享锁应用之Semaphore原理
我们调用Semaphore方法时,其实是在间接调用其内部类或AQS方法执行的.Semaphore类结构与ReetrantLock类相似,内部类Sync继承自AQS,然后其子类FairSync和NoFa ...
- BZOJ2599:[IOI2011]Race
浅谈树分治:https://www.cnblogs.com/AKMer/p/10014803.html 题目传送门:https://www.lydsy.com/JudgeOnline/problem. ...
- Linux 无法登陆172.***.***.***的子网
1. sudo dhclient -r 这条命令重复执行几次 2. dhclient - 3.查看ifconfig
- PHP正则匹配中文汉字注意
preg_match('/^[a-zA-Z\x{4e00}-\x{9fa5}]+$/u', $str) 如上,是匹配字母或者汉字的,一定要在后面加模式修饰符 u , 不然就出错! u (PCRE_UT ...
- CentOS6.6 zookeeper完全集群搭建
centos6.6搭建zookeeper-3.4.6完全分布式环境 转载 2015-06-28 22:14:17 标签:it 为了搭建HBase完全分布式环境,前提就是搭建好zookeeper和Had ...