結果

問題 No.1673 Lamps on a line
ユーザー convexineqconvexineq
提出日時 2021-09-10 21:24:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 302 ms / 2,000 ms
コード長 194 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 81,172 KB
最終ジャッジ日時 2023-09-02 15:47:51
合計ジャッジ時間 4,271 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,360 KB
testcase_01 AC 73 ms
71,436 KB
testcase_02 AC 215 ms
77,468 KB
testcase_03 AC 215 ms
77,420 KB
testcase_04 AC 289 ms
77,456 KB
testcase_05 AC 108 ms
76,856 KB
testcase_06 AC 254 ms
77,284 KB
testcase_07 AC 231 ms
80,248 KB
testcase_08 AC 94 ms
78,940 KB
testcase_09 AC 277 ms
77,748 KB
testcase_10 AC 299 ms
79,004 KB
testcase_11 AC 112 ms
78,892 KB
testcase_12 AC 302 ms
81,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,Q = map(int,input().split())
ans = 0
res = [-1]*(n+2)
for _ in range(Q):
    L,R = map(int,input().split())
    for i in range(L,R+1):
        ans -= res[i]
        res[i] *= -1
    print(ans)
0