2739 | 2023-01-19 22:01:20 | kristof | Videójáték | python3 | Accepted 100/100 | 839ms | 93104 KiB |
#* Az az idő amely alatt megunom a játékot egyedül
MegunasiIdo = int(input())
#* Szüneteimnek száma, szüneteim range formában, listában
NEn = int(input())
LEn = []
for i in range(NEn):
rawInput = list(map(int, input().split()))
LEn.append(rawInput)
#* Barát szüneteinek száma, szünetei range formában, listában
NBarat = int(input())
LBarat = []
for i in range(NBarat):
rawInput = list(map(int, input().split()))
LBarat.append(rawInput)
#* Melyik indexnél tartok a listában (külön En, Barat)
IndexEn = IndexBarat = 0
#* Mostani unatkozas
UnatkozasMost = 0
#* Bal Ă©s jobb oldal a rangenek
b: int = 0
j: int = 0
EgyuttJatszottEgysegek = 0
while IndexEn < NEn and IndexBarat < NBarat:
b = max(LEn[IndexEn][0], LBarat[IndexBarat][0])
j = min(LEn[IndexEn][1], LBarat[IndexBarat][1])
if j >= b and LEn[IndexEn][0] + MegunasiIdo >= LBarat[IndexBarat][0]:
EgyuttJatszottEgysegek += j-b+1
LEn[IndexEn][0] = j
if LEn[IndexEn][1] < LBarat[IndexBarat][1]:
IndexEn += 1
else:
IndexBarat += 1
print(EgyuttJatszottEgysegek)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 17ms | 11304 KiB | ||||
2 | Accepted | 16ms | 11236 KiB | ||||
subtask2 | 10/10 | ||||||
3 | Accepted | 17ms | 11592 KiB | ||||
4 | Accepted | 17ms | 12100 KiB | ||||
5 | Accepted | 17ms | 12304 KiB | ||||
6 | Accepted | 17ms | 12172 KiB | ||||
7 | Accepted | 17ms | 12212 KiB | ||||
8 | Accepted | 17ms | 12444 KiB | ||||
9 | Accepted | 17ms | 12728 KiB | ||||
10 | Accepted | 17ms | 13060 KiB | ||||
11 | Accepted | 17ms | 13032 KiB | ||||
subtask3 | 20/20 | ||||||
12 | Accepted | 17ms | 12988 KiB | ||||
13 | Accepted | 17ms | 13272 KiB | ||||
14 | Accepted | 17ms | 13424 KiB | ||||
15 | Accepted | 17ms | 13532 KiB | ||||
16 | Accepted | 18ms | 13568 KiB | ||||
17 | Accepted | 20ms | 14184 KiB | ||||
18 | Accepted | 21ms | 14436 KiB | ||||
19 | Accepted | 24ms | 14440 KiB | ||||
20 | Accepted | 23ms | 14056 KiB | ||||
21 | Accepted | 23ms | 14240 KiB | ||||
22 | Accepted | 18ms | 14104 KiB | ||||
subtask4 | 30/30 | ||||||
23 | Accepted | 89ms | 21428 KiB | ||||
24 | Accepted | 273ms | 40984 KiB | ||||
25 | Accepted | 718ms | 84116 KiB | ||||
26 | Accepted | 839ms | 92492 KiB | ||||
27 | Accepted | 787ms | 92788 KiB | ||||
28 | Accepted | 319ms | 45076 KiB | ||||
29 | Accepted | 65ms | 19724 KiB | ||||
30 | Accepted | 63ms | 19348 KiB | ||||
31 | Accepted | 43ms | 16788 KiB | ||||
subtask5 | 40/40 | ||||||
32 | Accepted | 89ms | 21864 KiB | ||||
33 | Accepted | 286ms | 43544 KiB | ||||
34 | Accepted | 509ms | 66176 KiB | ||||
35 | Accepted | 688ms | 83508 KiB | ||||
36 | Accepted | 787ms | 93104 KiB | ||||
37 | Accepted | 813ms | 93004 KiB | ||||
38 | Accepted | 472ms | 65052 KiB | ||||
39 | Accepted | 586ms | 74492 KiB | ||||
40 | Accepted | 144ms | 29756 KiB | ||||
41 | Accepted | 215ms | 37820 KiB |