結果

問題 No.1673 Lamps on a line
ユーザー raven7959raven7959
提出日時 2021-09-20 09:18:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 81,240 KB
最終ジャッジ日時 2023-09-15 08:45:55
合計ジャッジ時間 4,110 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,424 KB
testcase_01 AC 72 ms
71,416 KB
testcase_02 AC 225 ms
78,024 KB
testcase_03 AC 231 ms
77,892 KB
testcase_04 AC 303 ms
78,308 KB
testcase_05 AC 120 ms
78,612 KB
testcase_06 AC 281 ms
77,928 KB
testcase_07 AC 227 ms
80,380 KB
testcase_08 AC 94 ms
79,172 KB
testcase_09 AC 283 ms
77,872 KB
testcase_10 AC 302 ms
79,216 KB
testcase_11 AC 116 ms
79,488 KB
testcase_12 AC 306 ms
81,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
N,Q=map(int,input().split())
lamp=[0]*(N)
cnt=0
for _ in range(Q):
  l,r=map(int,input().split())
  for i in range(l-1,r):
    if lamp[i]:
      cnt-=1
    else:
      cnt+=1
    lamp[i]=1-lamp[i]
  print(cnt)
0