Submission #223319

# Submission time Handle Problem Language Result Execution time Memory
223319 2020-04-15T07:13:27 Z dantoh000 Klasika (COCI20_klasika) C++14
0 / 110
633 ms 2144 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 10, LOG_A = 31;
int k;
int basis[LOG_A];
int num[N];
int sz;
int ct = 1;
void insertVector(int mask) {
	for (int i = 0; i < LOG_A; i++) {
		if ((mask & 1 << i) == 0) continue;
		if (!basis[i]) {
			basis[i] = mask;
			++sz;
			return;
		}
		mask ^= basis[i];
	}
}
int maxxor(int cur){
    for (int i = LOG_A; i >= 0; i--){
        if ((cur & 1<<i) == 0){
            if (basis[i]){
                cur ^= basis[i];
            }
        }
    }
    return cur;
}

int main() {
	int q;
	cin >> q;
	while (q--) {
        string Q;
        int a,b;
		cin >> Q >> a >> b;
		if (Q == "Add"){
            num[++ct] = num[a]^b;
            insertVector(num[ct]);
		}
        else if (Q == "Query"){
            if (b == 1) printf("%d\n",maxxor(num[a]));
        }
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 633 ms 2144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -