結果

問題 No.1673 Lamps on a line
ユーザー player
提出日時 2023-12-27 00:20:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 266 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 80,128 KB
最終ジャッジ日時 2024-09-27 15:18:47
合計ジャッジ時間 3,768 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n,q = map(int,input().split())
    lump = [0]*n
    ans = 0
    for i in range(q):
        l,r = map(int,input().split())
        l,r = l-1,r-1
        for j in range(l,r+1):
            if lump[j] == 0:
                lump[j] = 1
                ans += 1
            else:
                lump[j] = 0
                ans -= 1
        print(ans)
        
if __name__ == '__main__':
    main()
0