记录编号 |
39205 |
评测结果 |
AAAAAAAAAA |
题目名称 |
校草 |
最终得分 |
100 |
用户昵称 |
CC |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
1.177 s |
提交时间 |
2012-07-06 17:20:48 |
内存使用 |
35.58 MiB |
显示代码纯文本
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
const int INF = 1027423549;
struct man {
int a[5],index;
}f[1000005];
int t[1000005],ans[1000005],c[1000005];
bool done[1000005];
int n,e[4];
bool cmp(man x,man y) {
return x.a[e[1]] < y.a[e[1]];
}
int lowbit(int x) {
return x & -x;
}
void modify(int x,int y) {
c[x] = std::min(c[x],y);
while (x <= n) {
x += lowbit(x);
c[x] = std::min(c[x],y);
}
}
int find(int x) {
int tmp = c[x];
while (x >= 1) {
x -= lowbit(x);
tmp = std::min(tmp,c[x]);
}
return tmp;
}
void solve() {
sort(f + 1,f + n + 1,cmp);
memset(c,61,sizeof(c));
int u;
for (int i = 1;i <= n;i++) {
u = find(f[i].a[e[2]]);
if (u < f[i].a[e[3]]) {
if (!done[f[i].index]) ans[++ans[0]] = f[i].index;
done[f[i].index] = 1;
continue;
}
modify(f[i].a[e[2]],f[i].a[e[3]]);
}
}
int main() {
freopen("hjjhvf.in","r",stdin);
freopen("hjjhvf.out","w",stdout);
scanf("%d", &n);
for (int i = 1;i <= n;i++) {
scanf("%d%d%d%d", &f[i].a[1], &f[i].a[2], &f[i].a[3], &f[i].a[4]);
f[i].index = i;
}
e[1] = 1;e[2] = 2,e[3] = 3;
solve();
e[1] = 1;e[2] = 2;e[3] = 4;
solve();
e[1] = 1;e[2] = 3;e[3] = 4;
solve();
e[1] = 2;e[2] = 3;e[3] = 4;
solve();
sort(ans + 1,ans + ans[0] + 1);
printf("%d\n", ans[0]);
for (int i = 1;i <= ans[0];i++) {
printf("%d\n", ans[i]);
}
return 0;
}