Submission #59181364


Source Code Expand

Copy
def inc(S, M, L, R):
for i in range(1, L+1):
for j in range(R, M+1):
S |= {(i, j)}
return S
N, M = map(int, input().split())
included = set()
for _ in range(N):
L, R = map(int, input().split())
included = inc(included, M, L, R)
print(M * (M+1) // 2 - len(included))
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
def inc(S, M, L, R):
  for i in range(1, L+1):
    for j in range(R, M+1):
      S |= {(i, j)}
  return S


N, M = map(int, input().split())

included = set()
for _ in range(N):
  L, R = map(int, input().split())
  included = inc(included, M, L, R)

print(M * (M+1) // 2 - len(included))

Submission Info

Submission Time
Task D - Many Segments 2
User Verniy73
Language Python (CPython 3.11.4)
Score 0
Code Size 301 Byte
Status TLE
Exec Time 2259 ms
Memory 972156 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 11
TLE × 21
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt, 02_random_21.txt, 02_random_22.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 10 ms 8480 KB
00_sample_01.txt AC 10 ms 8420 KB
00_sample_02.txt AC 10 ms 8496 KB
01_handmade_00.txt AC 10 ms 8512 KB
01_handmade_01.txt TLE 2258 ms 963072 KB
01_handmade_02.txt AC 10 ms 8472 KB
01_handmade_03.txt AC 10 ms 8460 KB
01_handmade_04.txt AC 10 ms 8504 KB
01_handmade_05.txt AC 10 ms 8516 KB
02_random_00.txt TLE 2254 ms 888448 KB
02_random_01.txt TLE 2241 ms 642352 KB
02_random_02.txt TLE 2258 ms 954740 KB
02_random_03.txt TLE 2258 ms 956428 KB
02_random_04.txt TLE 2258 ms 964328 KB
02_random_05.txt TLE 2252 ms 878024 KB
02_random_06.txt TLE 2234 ms 511600 KB
02_random_07.txt TLE 2259 ms 966236 KB
02_random_08.txt TLE 2258 ms 966556 KB
02_random_09.txt TLE 2258 ms 967100 KB
02_random_10.txt TLE 2258 ms 963484 KB
02_random_11.txt TLE 2259 ms 970988 KB
02_random_12.txt TLE 2258 ms 955968 KB
02_random_13.txt TLE 2259 ms 972156 KB
02_random_14.txt TLE 2258 ms 953588 KB
02_random_15.txt TLE 2258 ms 962780 KB
02_random_16.txt AC 465 ms 8584 KB
02_random_17.txt AC 400 ms 8452 KB
02_random_18.txt AC 419 ms 8492 KB
02_random_19.txt TLE 2212 ms 80796 KB
02_random_20.txt TLE 2212 ms 77152 KB
02_random_21.txt TLE 2212 ms 82588 KB
02_random_22.txt TLE 2212 ms 92188 KB


2025-03-21 (Fri)
01:55:48 +00:00