結果

問題 No.1673 Lamps on a line
ユーザー etale.K3etale.K3
提出日時 2021-10-12 22:46:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 965 ms / 2,000 ms
コード長 214 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 11,700 KB
実行使用メモリ 13,716 KB
最終ジャッジ日時 2023-10-17 12:10:44
合計ジャッジ時間 7,256 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,948 KB
testcase_01 AC 29 ms
9,948 KB
testcase_02 AC 361 ms
9,960 KB
testcase_03 AC 359 ms
9,960 KB
testcase_04 AC 607 ms
9,960 KB
testcase_05 AC 59 ms
9,960 KB
testcase_06 AC 534 ms
9,960 KB
testcase_07 AC 486 ms
12,664 KB
testcase_08 AC 38 ms
11,936 KB
testcase_09 AC 714 ms
10,352 KB
testcase_10 AC 743 ms
11,672 KB
testcase_11 AC 95 ms
11,936 KB
testcase_12 AC 965 ms
13,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, Q = map(int, input().split())

ans = 0
Lst = [0] * N

for i in range(Q):
	L, R = map(int, input().split())
	for i in range(L-1, R):
		Lst[i] += 1
		if Lst[i] % 2 == 0:
			ans -= 1
		else:
			ans += 1
	print(ans)
0