結果

問題 No.1673 Lamps on a line
ユーザー mrngmrng
提出日時 2021-12-16 23:28:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 205 bytes
コンパイル時間 929 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 81,448 KB
最終ジャッジ日時 2023-10-11 23:15:27
合計ジャッジ時間 5,540 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,344 KB
testcase_01 AC 77 ms
71,020 KB
testcase_02 AC 241 ms
78,172 KB
testcase_03 AC 237 ms
78,328 KB
testcase_04 AC 315 ms
78,088 KB
testcase_05 AC 124 ms
78,676 KB
testcase_06 AC 286 ms
77,940 KB
testcase_07 AC 232 ms
80,388 KB
testcase_08 AC 97 ms
79,020 KB
testcase_09 AC 299 ms
77,844 KB
testcase_10 AC 311 ms
79,380 KB
testcase_11 AC 120 ms
79,488 KB
testcase_12 AC 312 ms
81,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,q = map(int,input().split())
a = 0
on = [0]*n
for _ in range(q):
	l,r = map(int,input().split())
	l -= 1
	r -= 1
	for i in range(l,r+1):
		if on[i]: a -= 1; on[i] = 0
		else: a += 1; on[i] = 1
	print(a)
0