結果

問題 No.2879 Range Flip Queries
ユーザー Iroha_3856Iroha_3856
提出日時 2024-09-06 22:36:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 509 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 473 ms
コンパイル使用メモリ 82,764 KB
実行使用メモリ 144,744 KB
最終ジャッジ日時 2024-09-08 12:01:32
合計ジャッジ時間 13,867 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,424 KB
testcase_01 AC 37 ms
53,800 KB
testcase_02 AC 37 ms
53,884 KB
testcase_03 AC 261 ms
76,448 KB
testcase_04 AC 255 ms
76,644 KB
testcase_05 AC 256 ms
76,240 KB
testcase_06 AC 257 ms
76,260 KB
testcase_07 AC 262 ms
76,236 KB
testcase_08 AC 44 ms
59,788 KB
testcase_09 AC 38 ms
54,360 KB
testcase_10 AC 43 ms
59,880 KB
testcase_11 AC 40 ms
54,340 KB
testcase_12 AC 42 ms
61,600 KB
testcase_13 AC 381 ms
118,256 KB
testcase_14 AC 407 ms
123,808 KB
testcase_15 AC 302 ms
96,672 KB
testcase_16 AC 176 ms
102,412 KB
testcase_17 AC 332 ms
131,164 KB
testcase_18 AC 507 ms
140,816 KB
testcase_19 AC 509 ms
144,124 KB
testcase_20 AC 494 ms
144,196 KB
testcase_21 AC 480 ms
144,580 KB
testcase_22 AC 482 ms
140,932 KB
testcase_23 AC 473 ms
140,968 KB
testcase_24 AC 488 ms
144,592 KB
testcase_25 AC 478 ms
144,744 KB
testcase_26 AC 481 ms
144,588 KB
testcase_27 AC 467 ms
144,520 KB
testcase_28 AC 474 ms
144,492 KB
testcase_29 AC 410 ms
144,608 KB
testcase_30 AC 409 ms
144,496 KB
testcase_31 AC 404 ms
144,440 KB
testcase_32 AC 412 ms
144,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#入力
N, Q = map(int, input().split())
A = list(map(int, input().split()))

#Bを計算する
B = [0 for i in range(N+1)]
for i in range(Q):
	l, r = map(int, input().split())
	B[l-1]^=1 #B[l-1]+=1, B[l-1]%2 と同じ
	B[r]^=1 #B[r]+1, B[r]%2 と同じ

#累積させる
for i in range(1, N):
	B[i] ^= B[i-1]
#Bを用いてAを変化させる
for i in range(N):
	A[i] ^= B[i]

#出力
print(*A)
0