1#include <cstdio>2#include <cstring>3#include <cmath>4#include <iostream>5#include <algorithm>6 intf[257][257],n,type,v[257],g[257][257],ans,cnt;7 Charop[204];8 intRead () {9 intt=0, f=1;CharCh=GetChar ();Ten while(ch<'0'|| Ch>'9'){if(ch=='-') f=-1; ch=GetChar ();} One while('0'<=ch&&ch<='9') {t=t*Ten+ch-'0'; ch=GetChar ();} A returnt*F; - } - intFunintXinty) { the if(op[0]=='a')returnx&y; - Else - if(op[0]=='o')returnX|y; - returnx^y; + } - voidAddintx) { + intA=x>>8,b=x&255; Av[a]=1; at for(intI=0;i< the; i++){ - intk=Fun (i,b); - if(K>f[a][i]) f[a][i]=k,g[a][i]=1; - Else if(K==f[a][i]) g[a][i]++; - } - } in voidAskintx) { - intA=x>>8,b=x&255; toAns=cnt=0; + for(intI=0;i< the; i++)if(V[i]) { - intK=fun (i,a) <<8|F[i][b]; the if(K>ans) ans=k,cnt=g[i][b];Else * if(K==ans) cnt+=G[i][b]; $ }Panax Notoginseng } - intMain () { theN=read (); scanf ("%s", op); type=read (); + for(intI=1; i<=n;i++){ A intx; thescanf"%d",&x); + if(i!=1){ - ask (x); $ if(type) printf ("%d%d\n", ans,cnt); $ Elseprintf"%d\n", ans); - } - Add (x); the } - return 0;Wuyi}
Noi 10 double Test T1