結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-17 23:08:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 157 ms / 2,000 ms |
| コード長 | 456 bytes |
| コンパイル時間 | 239 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 86,784 KB |
| 最終ジャッジ日時 | 2024-11-17 07:36:27 |
| 合計ジャッジ時間 | 3,104 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
import sys
if sys.platform =='ios':
import clipboard
a=clipboard.get()
a = a.split('\n')
text = '\n'.join(a)
with open('input_file.txt','w') as f:
f.write(text)
sys.stdin = open('input_file.txt')
n,q = map(int,input().split())
R = [0]*(n+1)
ans = []
c = 0
for i in range(q):
l,r = map(int,input().split())
for i in range(l-1,r):
if R[i] == 0:
c += 1
R[i] = 1
elif R[i] == 1:
c -= 1
R[i] = 0
ans.append(c)
print(*ans,sep = "\n")