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