結果
| 問題 | 
                            No.1673 Lamps on a line
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-09-11 01:19:05 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 422 bytes | 
| コンパイル時間 | 191 ms | 
| コンパイル使用メモリ | 82,224 KB | 
| 実行使用メモリ | 314,316 KB | 
| 最終ジャッジ日時 | 2024-06-12 22:20:17 | 
| 合計ジャッジ時間 | 4,918 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 TLE * 1 -- * 5 | 
ソースコード
from sys import stdin
def main(inp, inps):
    N, Q = map(int, inp().split())
    L, R = list(zip(*map(lambda x: list(map(int, x.split())), inps())))
    now_bit = 0
    result = [0]*Q
    for i, (l, r) in enumerate(zip(L, R)):
        now_bit ^= int("1"*(r-l+1) + "0"*(l-1), 2)
        result[i] = sum(map(int, list(bin(now_bit)[2:])))
    
    print("\n".join(map(str, result)))
main(stdin.readline, stdin.readlines)