結果

問題 No.1673 Lamps on a line
ユーザー pluto77pluto77
提出日時 2021-09-26 12:58:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 915 ms / 2,000 ms
コード長 182 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 11,928 KB
最終ジャッジ日時 2023-09-19 02:51:48
合計ジャッジ時間 6,078 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,916 KB
testcase_01 AC 16 ms
7,824 KB
testcase_02 AC 348 ms
7,796 KB
testcase_03 AC 334 ms
7,804 KB
testcase_04 AC 583 ms
7,828 KB
testcase_05 AC 44 ms
7,824 KB
testcase_06 AC 498 ms
7,820 KB
testcase_07 AC 456 ms
10,868 KB
testcase_08 AC 24 ms
9,840 KB
testcase_09 AC 689 ms
8,588 KB
testcase_10 AC 708 ms
9,848 KB
testcase_11 AC 80 ms
10,136 KB
testcase_12 AC 915 ms
11,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1673
n,q=map(int,input().split())
ls=[0]*n
s=0
for i in range(q):
 l,r=map(int,input().split())
 for j in range(l-1,r):
  ls[j]^=1
  if ls[j]:
   s+=1
  else:
   s-=1
 print(s)
0