結果

問題 No.1673 Lamps on a line
ユーザー hydruhydru
提出日時 2021-09-10 21:56:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 246 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 81,120 KB
最終ジャッジ日時 2023-09-02 17:16:36
合計ジャッジ時間 4,186 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
70,920 KB
testcase_01 AC 74 ms
71,320 KB
testcase_02 AC 224 ms
77,536 KB
testcase_03 AC 220 ms
77,248 KB
testcase_04 AC 298 ms
77,324 KB
testcase_05 AC 112 ms
77,212 KB
testcase_06 AC 261 ms
77,272 KB
testcase_07 AC 233 ms
80,188 KB
testcase_08 AC 94 ms
78,628 KB
testcase_09 AC 289 ms
77,520 KB
testcase_10 AC 308 ms
79,136 KB
testcase_11 AC 117 ms
79,232 KB
testcase_12 AC 313 ms
81,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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