結果

問題 No.1673 Lamps on a line
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-09-10 21:40:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 314 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 81,240 KB
最終ジャッジ日時 2023-09-02 16:25:08
合計ジャッジ時間 4,359 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,296 KB
testcase_01 AC 77 ms
71,060 KB
testcase_02 AC 266 ms
78,076 KB
testcase_03 AC 242 ms
77,664 KB
testcase_04 AC 314 ms
77,996 KB
testcase_05 AC 124 ms
78,116 KB
testcase_06 AC 285 ms
77,720 KB
testcase_07 AC 234 ms
80,160 KB
testcase_08 AC 97 ms
79,152 KB
testcase_09 AC 293 ms
77,748 KB
testcase_10 AC 314 ms
79,372 KB
testcase_11 AC 119 ms
79,340 KB
testcase_12 AC 307 ms
81,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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