結果
問題 | No.1673 Lamps on a line |
ユーザー | ossa_2019 |
提出日時 | 2021-09-11 02:44:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 178 ms / 2,000 ms |
コード長 | 491 bytes |
コンパイル時間 | 510 ms |
コンパイル使用メモリ | 87,380 KB |
実行使用メモリ | 112,024 KB |
最終ジャッジ日時 | 2023-09-03 21:44:43 |
合計ジャッジ時間 | 3,453 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 68 ms
71,424 KB |
testcase_01 | AC | 69 ms
71,476 KB |
testcase_02 | AC | 129 ms
92,356 KB |
testcase_03 | AC | 126 ms
92,176 KB |
testcase_04 | AC | 166 ms
105,484 KB |
testcase_05 | AC | 83 ms
77,068 KB |
testcase_06 | AC | 146 ms
97,864 KB |
testcase_07 | AC | 136 ms
96,560 KB |
testcase_08 | AC | 80 ms
78,892 KB |
testcase_09 | AC | 165 ms
105,156 KB |
testcase_10 | AC | 175 ms
107,040 KB |
testcase_11 | AC | 90 ms
79,936 KB |
testcase_12 | AC | 178 ms
112,024 KB |
ソースコード
from sys import stdin from sys import stdout def main(inp, inps, put): N, Q = map(int, inp().split()) L, R = list(zip(*map(lambda x: list(map(int, x.split())), inps()))) result = [0]*Q bits = [1]*(N+2) now_sum = 0 for i, (l, r) in enumerate(zip(L, R)): for j in range(l, r+1): now_sum += bits[j] bits[j] *= -1 result[i] = now_sum put("\n".join(map(str, result))) main(stdin.readline, stdin.readlines, stdout.write)