Submission #703243

# Submission time Handle Problem Language Result Execution time Memory
703243 2023-02-26T17:08:30 Z rainboy XORanges (eJOI19_xoranges) C
0 / 100
110 ms 8596 KB
#include <stdio.h>

#define N	200000

void update(int *ft, int i, int n, int x) {
	while (i < n) {
		ft[i] ^= x;
		i |= i + 1;
	}
}

int query(int *ft, int i) {
	int x = 0;

	while (i >= 0) {
		x ^= ft[i];
		i &= i + 1, i--;
	}
	return x;
}

int main() {
	static int aa[N], ft[2][N];
	int n, q, i;

	scanf("%d%d", &n, &q);
	for (i = 0; i < n; i++) {
		scanf("%d", &aa[i]);
		update(ft[i % 2], i, n, aa[i]);
	}
	while (q--) {
		int t, a, l, r;

		scanf("%d", &t);
		if (t == 1) {
			scanf("%d%d", &i, &a), i--;
			update(ft[i % 2], i, n, aa[i] ^ a);
			aa[i] = a;
		} else {
			scanf("%d%d", &l, &r), l--, r--;
			printf("%d\n", (r - l) % 2 != 0 ? 0 : query(ft[l % 2], r) - query(ft[l % 2], l - 1));
		}
	}
	return 0;
}

Compilation message

xoranges.c: In function 'main':
xoranges.c:26:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |  scanf("%d%d", &n, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~
xoranges.c:28:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
xoranges.c:34:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |   scanf("%d", &t);
      |   ^~~~~~~~~~~~~~~
xoranges.c:36:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |    scanf("%d%d", &i, &a), i--;
      |    ^~~~~~~~~~~~~~~~~~~~~
xoranges.c:40:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |    scanf("%d%d", &l, &r), l--, r--;
      |    ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 110 ms 8596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -