답안 #508533

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
508533 2022-01-13T11:47:21 Z sidon XOR (IZhO12_xor) C++17
0 / 100
2000 ms 142908 KB
#include <bits/stdc++.h>
using namespace std;

int N, X, pref, ind, k;
unordered_map<int, int> t[30];

void minim(int l, int r) {
	if(l && r-l > k) k = r-l, ind = l;
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);

	cin >> N >> X;

	for(int i = 1; i <= N + 1; i++) {
		int u = 0;
		for(int j = 30; --j >= 0; ) {
			if(X & (1<<j)) {
				if(!(pref & (1<<j))) u ^= 1<<j;
				if(!j) minim(t[j][u], i);
			} else {
				if(pref & (1<<j)) minim(t[j][u], i), u ^= 1<<j;
				else minim(t[j][u ^ (1<<j)], i);
			}
		}
		minim(t[0][u], i);
		int v = 0;
		for(int j = 30; --j >= 0; ) {
			if(pref & (1<<j)) v |= 1<<j;
			t[j][v] = t[j][v] ? : i;
		}

		cin >> v;
		pref ^= v;
	}
	if(!X) ind = 1, k = N;

	cout << ind << ' ' << k;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 2 ms 460 KB Output is correct
4 Correct 4 ms 844 KB Output is correct
5 Correct 29 ms 2864 KB Output is correct
6 Correct 49 ms 3772 KB Output is correct
7 Correct 43 ms 3044 KB Output is correct
8 Correct 39 ms 3832 KB Output is correct
9 Correct 898 ms 57176 KB Output is correct
10 Correct 836 ms 58816 KB Output is correct
11 Correct 829 ms 55296 KB Output is correct
12 Correct 780 ms 52808 KB Output is correct
13 Correct 792 ms 50900 KB Output is correct
14 Correct 841 ms 53644 KB Output is correct
15 Correct 1040 ms 67224 KB Output is correct
16 Correct 779 ms 51076 KB Output is correct
17 Execution timed out 2073 ms 142908 KB Time limit exceeded
18 Halted 0 ms 0 KB -