QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#667362#9518. 观虫我 (旧版数据)Kevin5307Judgement Failed//C++231.3kb2024-10-22 22:27:242024-10-22 22:27:24

Judging History

你现在查看的是最新测评结果

  • [2024-10-22 22:27:24]
  • 评测
  • [2024-10-22 22:27:24]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
const int B=8;
bitset<1000000> bs[4][1<<B];
int c=0;
int main()
{
	double st=clock();
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,q;
	cin>>n>>q;
	while(q--&&(clock()-st)<=9.99*CLOCKS_PER_SEC)
	{
		char ch;
		ull x;
		cin>>ch>>x;
		if(ch=='!')
		{
			for(int i=0;i<4;i++)
			{
				int tmp=x&((1<<B)-1);
				for(int j=0;j<(1<<B);j++) if(tmp==(tmp&j))
					bs[i][j][c]=1;
				x>>=B;
			}
			c++;
		}
		else
		{
			int val[4];
			for(int i=0;i<4;i++)
			{
				val[i]=x&((1<<B)-1);
				x>>=B;
			}
			cout<<((bs[0][val[0]]&bs[1][val[1]]&bs[2][val[2]]&bs[3][val[3]]).count()&1)<<'\n';
		}
	}
	return 0;
}

Details

Failed to show details