結果

問題 No.1673 Lamps on a line
ユーザー 👑 H20H20
提出日時 2021-09-10 21:24:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 314 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 81,068 KB
最終ジャッジ日時 2023-09-02 15:47:39
合計ジャッジ時間 3,968 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,332 KB
testcase_01 AC 75 ms
71,180 KB
testcase_02 AC 224 ms
77,492 KB
testcase_03 AC 218 ms
77,352 KB
testcase_04 AC 296 ms
77,168 KB
testcase_05 AC 115 ms
77,192 KB
testcase_06 AC 267 ms
77,276 KB
testcase_07 AC 234 ms
80,064 KB
testcase_08 AC 98 ms
79,020 KB
testcase_09 AC 295 ms
77,912 KB
testcase_10 AC 308 ms
79,136 KB
testcase_11 AC 120 ms
79,292 KB
testcase_12 AC 314 ms
81,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


0