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 ;
}

最新文章

  1. Gson运用
  2. LR自定义函数以及调用
  3. EL标签使用
  4. NSPredicate
  5. 记OC迁移至swift中笔记20tips
  6. MVC的EF编辑,不用查询直接修改
  7. unity 脚本编译顺序
  8. IOS消息推送情况总结
  9. 在汉澳sinox2014建立ZFS高可靠文件存储系统
  10. twisted学习笔记4 部署Twisted 应用程序
  11. nlog学习使用
  12. django celery的分布式异步之路(二) 高并发
  13. openresty用naxsi防xss、SQL注入
  14. JS模板引擎handlebars.js的简单使用
  15. [POI2013]Taks&#243;wki
  16. Linux下使用Nohup后台运行程序
  17. 【转载】Linux命令行常用光标移动快捷键
  18. Netty 使用经验总结(一)
  19. 通读cheerio API-网络爬虫
  20. TStringGrid的Rows索引值 和 Cells的 索引值, Row的赋值

热门文章

  1. #pragma once与#ifndef
  2. iOS 两个tableview的 瀑布流
  3. Chapter2——如何分析Android程序
  4. 「LOJ#10015」「一本通 1.2 练习 2」扩散(并查集
  5. linux 查看某进程 并杀死进程 ps grep kill
  6. inline关键字的用法详解
  7. DAG上的DP
  8. 【219】◀▶ IDL 数学函数说明
  9. HDOJ-2045
  10. 2.11-2.12 HBase的数据迁移常见方式