結果

問題 No.1673 Lamps on a line
ユーザー kyaneko999kyaneko999
提出日時 2021-09-10 22:14:50
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 186 bytes
コンパイル時間 1,199 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 81,124 KB
最終ジャッジ日時 2023-09-02 18:10:55
合計ジャッジ時間 4,737 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,196 KB
testcase_01 AC 71 ms
70,848 KB
testcase_02 AC 206 ms
77,372 KB
testcase_03 AC 202 ms
77,420 KB
testcase_04 AC 283 ms
77,280 KB
testcase_05 AC 111 ms
77,272 KB
testcase_06 AC 251 ms
77,184 KB
testcase_07 AC 219 ms
80,268 KB
testcase_08 AC 91 ms
79,316 KB
testcase_09 AC 272 ms
77,844 KB
testcase_10 AC 291 ms
79,112 KB
testcase_11 AC 110 ms
79,444 KB
testcase_12 AC 280 ms
81,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q=map(int,input().split())
dp=[0]*(N+1)
ans=0
for _ in range(Q):
    l,r=map(int,input().split())
    for x in range(l,r+1):
      dp[x]^=1
      ans+=1 if dp[x] else -1
    print(ans)
0