結果

問題 No.1673 Lamps on a line
ユーザー tcltktcltk
提出日時 2021-10-16 12:03:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,736 KB
実行使用メモリ 93,004 KB
最終ジャッジ日時 2023-10-17 22:07:27
合計ジャッジ時間 4,171 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
86,056 KB
testcase_01 AC 127 ms
86,056 KB
testcase_02 AC 174 ms
89,028 KB
testcase_03 AC 170 ms
89,028 KB
testcase_04 AC 183 ms
89,124 KB
testcase_05 AC 155 ms
88,780 KB
testcase_06 AC 176 ms
89,132 KB
testcase_07 AC 178 ms
91,920 KB
testcase_08 AC 147 ms
91,060 KB
testcase_09 AC 188 ms
89,576 KB
testcase_10 AC 197 ms
90,992 KB
testcase_11 AC 152 ms
90,968 KB
testcase_12 AC 186 ms
93,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)

INF = 10**10



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


0