結果

問題 No.1673 Lamps on a line
ユーザー NoneNone
提出日時 2021-10-04 16:19:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 325 ms / 2,000 ms
コード長 258 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 81,340 KB
最終ジャッジ日時 2023-09-29 21:52:38
合計ジャッジ時間 4,679 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,528 KB
testcase_01 AC 70 ms
71,360 KB
testcase_02 AC 231 ms
78,364 KB
testcase_03 AC 235 ms
78,456 KB
testcase_04 AC 325 ms
78,320 KB
testcase_05 AC 116 ms
78,268 KB
testcase_06 AC 287 ms
77,708 KB
testcase_07 AC 225 ms
80,400 KB
testcase_08 AC 90 ms
78,948 KB
testcase_09 AC 284 ms
77,988 KB
testcase_10 AC 299 ms
79,412 KB
testcase_11 AC 112 ms
79,580 KB
testcase_12 AC 302 ms
81,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q=map(int, input().split())
A=[0]*N
S=0
for _ in range(Q):
    l,r=map(int, input().split())
    l-=1
    r-=1
    for i in range(l,r+1):
        if A[i]==0:
            S+=1
            A[i]=1
        else:
            S-=1
            A[i]=0
    print(S)
0