結果

問題 No.1673 Lamps on a line
ユーザー googol_S0googol_S0
提出日時 2021-09-10 21:22:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 316 ms / 2,000 ms
コード長 191 bytes
コンパイル時間 386 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 81,256 KB
最終ジャッジ日時 2023-09-02 15:40:09
合計ジャッジ時間 4,229 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,332 KB
testcase_01 AC 73 ms
71,608 KB
testcase_02 AC 260 ms
78,148 KB
testcase_03 AC 244 ms
77,888 KB
testcase_04 AC 315 ms
78,300 KB
testcase_05 AC 122 ms
78,452 KB
testcase_06 AC 282 ms
77,940 KB
testcase_07 AC 232 ms
80,388 KB
testcase_08 AC 96 ms
78,928 KB
testcase_09 AC 299 ms
78,016 KB
testcase_10 AC 311 ms
79,416 KB
testcase_11 AC 121 ms
79,460 KB
testcase_12 AC 316 ms
81,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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