結果

問題 No.1673 Lamps on a line
ユーザー dangodango
提出日時 2023-06-25 12:24:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 424 ms / 2,000 ms
コード長 196 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 81,324 KB
最終ジャッジ日時 2023-09-15 08:43:12
合計ジャッジ時間 5,786 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,340 KB
testcase_01 AC 71 ms
71,284 KB
testcase_02 AC 338 ms
81,324 KB
testcase_03 AC 298 ms
79,208 KB
testcase_04 AC 424 ms
79,580 KB
testcase_05 AC 176 ms
78,760 KB
testcase_06 AC 366 ms
79,300 KB
testcase_07 AC 247 ms
80,156 KB
testcase_08 AC 99 ms
78,992 KB
testcase_09 AC 313 ms
77,696 KB
testcase_10 AC 325 ms
78,892 KB
testcase_11 AC 119 ms
79,468 KB
testcase_12 AC 343 ms
81,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, Q = map(int, input().split())
P = [0] * N
S = 0
for i in range(Q):
	L, R = map(int, input().split())
	S -= sum(P[L - 1:R])
	for j in range(L - 1, R):
		P[j] ^= 1
	S += sum(P[L - 1:R])
	print(S)
0