Five-dimensional partial order: At first was frightened, and later learned a kind of bitset block method, feel very good.
Dumb Horse:
1#include <iostream>2#include <cstdio>3#include <algorithm>4#include <cstring>5#include <cmath>6#include <vector>7#include <bitset>8 #defineINF 10000000079 #defineMAXN 52000Ten #defineMAXM 520 One A using namespacestd; - - structscore the { - intx, y; -FriendBOOL operator<(score A, score B) - { + returna.x<b.x; - } +}s[6][MAXN]; A at intN,m,p,num,block; - intBEL[MAXN],L[MAXM],R[MAXM]; - inta[6][MAXN]; -bitset<50005> b[6][MAXM]; -bitset<50005> now[6]; - in intMain () - { to intCase ; +scanf"%d",&Case ); - for(intI=1; i<=5; i++) b[i][0].reset (); the for(into=1; o<=case;o++) * { $scanf"%d%d",&n,&m);Panax Notoginseng for(intj=1; j<=n;j++) - for(intI=1; i<=5; i++) the { +scanf"%d",&a[i][j]); As[i][j].x=A[i][j]; thes[i][j].y=J; + } - for(intI=1; i<=5; i++) $ { $Sort (s[i]+1, s[i]+n+1); -Sort (a[i]+1, a[i]+n+1); - } the intblock=sqrt (n); - intnum=n/block+ (n%block!=0);Wuyi for(intI=1; i<=n;i++) bel[i]= (i-1)/block+1; the for(intI=1; i<=num;i++) l[i]= (i-1) *block+1; - for(intI=1; i<=num;i++) r[i]=i*Block; Wur[num]=N; - for(intI=1; i<=5; i++) About for(intj=1; j<=num;j++) $ { -b[i][j]=b[i][j-1]; - for(intk=l[j];k<=r[j];k++) -b[i][j][s[i][k].y]=1; A } +scanf"%d",&p); the intx[6],ans=0; - for(intq=1; q<=p;q++) $ { the for(intI=1; i<=5; i++) scanf ("%d",&x[i]); the for(intI=1; i<=5; i++) x[i]^=ans; the for(intI=1; i<=5; i++) Now[i].reset (); the for(intI=1; i<=5; i++) - { in intTmp=upper_bound (a[i]+1, a[i]+n+1, X[i])-a[i]-1; the if(tmp==0)Continue; thenow[i]=b[i][bel[tmp]-1]; About for(intj=l[bel[tmp]];j<=tmp;j++) thenow[i][s[i][j].y]=1; the } thenow[0]=now[1]&now[2]&now[3]&now[4]&now[5]; +ans=now[0].count (); -printf"%d\n", ans); the }Bayi } the return 0; the}
score
Hiho Coder 1236 2015 Beijing online race score