結果

問題 No.1673 Lamps on a line
ユーザー hydruhydru
提出日時 2021-09-10 21:39:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 417 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 137,840 KB
最終ジャッジ日時 2023-09-02 16:21:26
合計ジャッジ時間 5,393 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
75,828 KB
testcase_01 AC 71 ms
71,352 KB
testcase_02 AC 219 ms
78,400 KB
testcase_03 AC 217 ms
78,392 KB
testcase_04 AC 297 ms
78,380 KB
testcase_05 AC 123 ms
78,348 KB
testcase_06 AC 265 ms
78,432 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def popcount(x):
    x = x - ((x >> 1) & 0x5555555555555555)

    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f

n,q=map(int,input().split())
A=0
for i in range(q):
    l,r=map(int,input().split())
    l=(1<<l-1)-1
    r=(1<<r)-1
    A=A^l^r
    print(popcount(A))
0