結果

問題 No.1673 Lamps on a line
ユーザー wolgnikwolgnik
提出日時 2021-09-10 21:26:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 260 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 82,772 KB
最終ジャッジ日時 2023-09-02 15:52:10
合計ジャッジ時間 3,344 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,448 KB
testcase_01 AC 74 ms
71,296 KB
testcase_02 AC 174 ms
79,444 KB
testcase_03 AC 163 ms
79,176 KB
testcase_04 AC 209 ms
81,104 KB
testcase_05 AC 120 ms
77,648 KB
testcase_06 AC 189 ms
79,992 KB
testcase_07 AC 131 ms
80,636 KB
testcase_08 AC 85 ms
78,948 KB
testcase_09 AC 140 ms
78,448 KB
testcase_10 AC 150 ms
79,456 KB
testcase_11 AC 99 ms
79,360 KB
testcase_12 AC 167 ms
82,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N, Q = map(int, input().split())

table = [0] * N
sm = 0
for _ in range(Q):
  l, r = map(int, input().split())
  sm -= sum(table[l - 1: r])
  for i in range(l - 1, r): table[i] ^= 1
  sm += sum(table[l - 1: r])
  print(sm)
0