結果

問題 No.1673 Lamps on a line
ユーザー 👑 rin204rin204
提出日時 2021-09-18 10:01:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 331 ms / 2,000 ms
コード長 219 bytes
コンパイル時間 2,119 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 81,092 KB
最終ジャッジ日時 2023-09-12 19:21:39
合計ジャッジ時間 5,012 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
70,972 KB
testcase_01 AC 69 ms
71,116 KB
testcase_02 AC 233 ms
77,936 KB
testcase_03 AC 234 ms
77,692 KB
testcase_04 AC 310 ms
77,900 KB
testcase_05 AC 116 ms
78,280 KB
testcase_06 AC 279 ms
77,752 KB
testcase_07 AC 237 ms
80,300 KB
testcase_08 AC 93 ms
78,876 KB
testcase_09 AC 296 ms
78,080 KB
testcase_10 AC 308 ms
79,180 KB
testcase_11 AC 120 ms
79,316 KB
testcase_12 AC 331 ms
81,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = map(int, input().split())
state = [False] * n
ans = 0

for _ in range(q):
    l, r = map(int, input().split())
    for i in range(l - 1, r):
        state[i] ^= True
        ans += state[i] * 2 - 1
    print(ans)
0