记录编号 |
39429 |
评测结果 |
AAAAAAAAAA |
题目名称 |
校草 |
最终得分 |
100 |
用户昵称 |
ZhouHang |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
1.879 s |
提交时间 |
2012-07-10 21:09:03 |
内存使用 |
31.76 MiB |
显示代码纯文本
/**
*Prob : hjjhvf
*Data : 2012-7-10
*Sol : ��״����
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MaxN 1000005
using namespace std;
struct node {
int a[5],x;
} f[MaxN];
int n,tot;
int c[MaxN],ans[MaxN];
int comp[5];
bool v[MaxN];
int lowbit(int x)
{
return x&(-x);
}
bool cmp(node x,node y)
{
return x.a[comp[1]]<y.a[comp[1]];
}
int findmin_3(int x)
{
int minv = c[x];
while (x>=1) {
x -= lowbit(x);
minv = min(minv,c[x]);
}
return minv;
}
void insert(int x,int y)
{
c[x] = min(c[x],y);
while (x<=n) {
x += lowbit(x);
c[x] = min(c[x],y);
}
}
void solve()
{
sort(f+1,f+1+n,cmp);
//��i����
memset(c,61,sizeof(c));
for (int i=1; i<=n; i++) {
int tmp = findmin_3(f[i].a[comp[2]]);
if (tmp<f[i].a[comp[3]])
if (!v[f[i].x]) {
v[f[i].x] = true;
ans[++tot] = f[i].x;
continue;
}
insert(f[i].a[comp[2]],f[i].a[comp[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].x = i;
}
tot = 0;
memset(ans,0,sizeof(ans));
memset(comp,0,sizeof(comp));
memset(v,false,sizeof(v));
comp[1] = 1; comp[2] = 2; comp[3] = 3;
solve();
comp[1] = 1; comp[2] = 2; comp[3] = 4;
solve();
comp[1] = 1; comp[2] = 3; comp[3] = 4;
solve();
comp[1] = 2; comp[2] = 3; comp[3] = 4;
solve();
printf("%d\n",tot);
sort(ans+1,ans+1+tot);
for (int i=1; i<=tot; i++)
printf("%d\n",ans[i]);
fclose(stdin); fclose(stdout);
return 0;
}