Submission #53293624


Source Code Expand

// LUOGU_RID: 158595147
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll MOD=1e9+7;
// head
const int N=35;
int x[N][2];
signed main() 
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n,c;cin>>n>>c;
    for(int i=0;i<=30;i++) x[i][1]=1;
    for(int i=0;i<n;i++){
    	int t,a;cin>>t>>a;
    	for(int j=0;j<=30;j++){
    		int tmp=((a>>j)&1);
			if(t==1) x[j][0]&=tmp,x[j][1]&=tmp;
			else if(t==2) x[j][0]|=tmp,x[j][1]|=tmp;
			else x[j][0]^=tmp,x[j][1]^=tmp;
		}
		int ans=0;
		for(int j=0;j<=30;j++){
			ans+=x[j][(c>>j)&1]*(1<<j);
		}
		c=ans;
		cout<<c<<endl;
	}
}

Submission Info

Submission Time
Task E - Many Operations
User gangbengr
Language C++ 17 (gcc 12.2)
Score 500
Code Size 874 Byte
Status AC
Exec Time 226 ms
Memory 3552 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 23
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All hand_01.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
hand_01.txt AC 1 ms 3420 KiB
random_01.txt AC 226 ms 3424 KiB
random_02.txt AC 114 ms 3356 KiB
random_03.txt AC 224 ms 3416 KiB
random_04.txt AC 97 ms 3460 KiB
random_05.txt AC 225 ms 3360 KiB
random_06.txt AC 79 ms 3416 KiB
random_07.txt AC 224 ms 3352 KiB
random_08.txt AC 7 ms 3392 KiB
random_09.txt AC 223 ms 3460 KiB
random_10.txt AC 190 ms 3416 KiB
random_11.txt AC 224 ms 3412 KiB
random_12.txt AC 150 ms 3352 KiB
random_13.txt AC 224 ms 3356 KiB
random_14.txt AC 213 ms 3412 KiB
random_15.txt AC 225 ms 3420 KiB
random_16.txt AC 225 ms 3416 KiB
random_17.txt AC 151 ms 3392 KiB
random_18.txt AC 223 ms 3352 KiB
random_19.txt AC 87 ms 3392 KiB
random_20.txt AC 224 ms 3416 KiB
sample_01.txt AC 1 ms 3408 KiB
sample_02.txt AC 1 ms 3552 KiB