2741 | 2023-01-19 23:00:35 | kristof | Videójáték | python3 | Accepted 100/100 | 833ms | 92764 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 | 11380 KiB | ||||
2 | Accepted | 17ms | 11676 KiB | ||||
subtask2 | 10/10 | ||||||
3 | Accepted | 17ms | 11712 KiB | ||||
4 | Accepted | 17ms | 11960 KiB | ||||
5 | Accepted | 16ms | 12020 KiB | ||||
6 | Accepted | 16ms | 12028 KiB | ||||
7 | Accepted | 16ms | 12212 KiB | ||||
8 | Accepted | 17ms | 12372 KiB | ||||
9 | Accepted | 17ms | 12656 KiB | ||||
10 | Accepted | 17ms | 12516 KiB | ||||
11 | Accepted | 17ms | 12452 KiB | ||||
subtask3 | 20/20 | ||||||
12 | Accepted | 17ms | 12804 KiB | ||||
13 | Accepted | 17ms | 12860 KiB | ||||
14 | Accepted | 17ms | 12672 KiB | ||||
15 | Accepted | 18ms | 13180 KiB | ||||
16 | Accepted | 18ms | 13472 KiB | ||||
17 | Accepted | 20ms | 13436 KiB | ||||
18 | Accepted | 21ms | 13744 KiB | ||||
19 | Accepted | 25ms | 13756 KiB | ||||
20 | Accepted | 21ms | 13920 KiB | ||||
21 | Accepted | 23ms | 14156 KiB | ||||
22 | Accepted | 18ms | 13508 KiB | ||||
subtask4 | 30/30 | ||||||
23 | Accepted | 90ms | 21348 KiB | ||||
24 | Accepted | 270ms | 40640 KiB | ||||
25 | Accepted | 689ms | 84028 KiB | ||||
26 | Accepted | 833ms | 92428 KiB | ||||
27 | Accepted | 823ms | 92396 KiB | ||||
28 | Accepted | 319ms | 44788 KiB | ||||
29 | Accepted | 65ms | 19012 KiB | ||||
30 | Accepted | 64ms | 18528 KiB | ||||
31 | Accepted | 41ms | 16268 KiB | ||||
subtask5 | 40/40 | ||||||
32 | Accepted | 90ms | 21548 KiB | ||||
33 | Accepted | 291ms | 43588 KiB | ||||
34 | Accepted | 529ms | 65816 KiB | ||||
35 | Accepted | 699ms | 82984 KiB | ||||
36 | Accepted | 777ms | 92480 KiB | ||||
37 | Accepted | 787ms | 92764 KiB | ||||
38 | Accepted | 479ms | 64488 KiB | ||||
39 | Accepted | 563ms | 74084 KiB | ||||
40 | Accepted | 145ms | 29316 KiB | ||||
41 | Accepted | 221ms | 37288 KiB |