結果

問題 No.2879 Range Flip Queries
ユーザー hiro1729
提出日時 2024-06-09 19:36:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 530 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 144,760 KB
最終ジャッジ日時 2024-09-08 12:00:37
合計ジャッジ時間 14,719 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

def Input():
	S = input()
	if S[0] == ' ' or S[-1] == ' ':
		assert(False)
	return S

N, Q = map(int, Input().split())
assert(1 <= N <= 500000 and 1 <= Q <= 500000)
A = list(map(int, Input().split()))
c = [0] * (N + 1) # xor版いもす法
for _ in range(Q):
	L, R = map(int, Input().split())
	assert(1 <= L <= R <= N)
	c[L - 1] ^= 1
	c[R] ^= 1
for i in range(N):
	c[i + 1] ^= c[i]
print(*[c[i] ^ A[i] for i in range(N)])
try:
	input()
	assert(False)
except:
	pass
0