結果

問題 No.1673 Lamps on a line
ユーザー first_vilfirst_vil
提出日時 2021-09-10 21:24:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 308 ms / 2,000 ms
コード長 193 bytes
コンパイル時間 1,495 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 81,036 KB
最終ジャッジ日時 2023-09-02 15:47:12
合計ジャッジ時間 5,474 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,240 KB
testcase_01 AC 76 ms
71,136 KB
testcase_02 AC 278 ms
77,272 KB
testcase_03 AC 218 ms
77,416 KB
testcase_04 AC 296 ms
77,332 KB
testcase_05 AC 112 ms
76,904 KB
testcase_06 AC 264 ms
77,276 KB
testcase_07 AC 235 ms
79,932 KB
testcase_08 AC 99 ms
78,756 KB
testcase_09 AC 288 ms
77,764 KB
testcase_10 AC 301 ms
79,272 KB
testcase_11 AC 117 ms
78,776 KB
testcase_12 AC 308 ms
81,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,q=map(int,input().split())
cnt=0
f=[0]*(n+10)
for _ in range(q):
    l,r=map(int,input().split())
    for i in range(l,r+1):
        cnt-=f[i]
        f[i]^=1
        cnt+=f[i]
    print(cnt)
0