2826 | 2023-01-28 16:11:04 | VMGoJo | Videójáték | python3 | Time limit exceeded 0/100 | 2.099s | 164104 KiB |
from sys import stdin, stdout
def main():
global hanop
hanop = int(0)
t = int(stdin.readline())
n = int(stdin.readline())
te_szuneted=[]
hano_szunete=[]
for i in range(0,n):
te_szuneted.append(stdin.readline().split())
m = int(stdin.readline())
for j in range(m):
hano_szunete.append(stdin.readline().split())
#print(te_szuneted)
#print(hano_szunete)
opercek:int = 0
tszam:int = 0
te_szuneted = [[int(j) for j in i] for i in te_szuneted]
hano_szunete = [[int(j) for j in i] for i in hano_szunete]
#print(te_szuneted)
#print(hano_szunete)
def online(ido:int, hano_szunete_p:list[list[int]]) -> bool:
global hanop
try:
while hano_szunete_p[hanop][1] < ido:
hanop+=1
if hanop>=len(hano_szunete_p):
return False
except Exception:return False
if hano_szunete_p[hanop][0] <= ido:
return True
else:
#print(f"false, ido: {ido} ")
return False
for i in te_szuneted:
for j in range(i[0],i[1]+1):
#print("ido: "+str(j))
tszam+=1
if online(j,hano_szunete):
tszam = 0
#print(f"i: {i} j: {j}")
opercek+=1
if tszam==t:
break
tszam=0
stdout.write(str(int(opercek)))
return 0
main()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 19ms | 12240 KiB | ||||
2 | Accepted | 17ms | 12688 KiB | ||||
subtask2 | 0/10 | ||||||
3 | Accepted | 17ms | 12764 KiB | ||||
4 | Accepted | 57ms | 12900 KiB | ||||
5 | Accepted | 17ms | 13060 KiB | ||||
6 | Accepted | 18ms | 13516 KiB | ||||
7 | Accepted | 17ms | 13576 KiB | ||||
8 | Accepted | 472ms | 13808 KiB | ||||
9 | Accepted | 17ms | 13968 KiB | ||||
10 | Accepted | 1.042s | 13900 KiB | ||||
11 | Time limit exceeded | 2.078s | 5844 KiB | ||||
subtask3 | 0/20 | ||||||
12 | Accepted | 17ms | 13820 KiB | ||||
13 | Accepted | 86ms | 13944 KiB | ||||
14 | Time limit exceeded | 2.046s | 6572 KiB | ||||
15 | Accepted | 17ms | 14692 KiB | ||||
16 | Accepted | 20ms | 14776 KiB | ||||
17 | Time limit exceeded | 2.099s | 7084 KiB | ||||
18 | Time limit exceeded | 2.051s | 7276 KiB | ||||
19 | Time limit exceeded | 2.023s | 7472 KiB | ||||
20 | Wrong answer | 20ms | 15464 KiB | ||||
21 | Wrong answer | 21ms | 16000 KiB | ||||
22 | Wrong answer | 18ms | 15176 KiB | ||||
subtask4 | 0/30 | ||||||
23 | Accepted | 68ms | 29844 KiB | ||||
24 | Accepted | 202ms | 63348 KiB | ||||
25 | Accepted | 492ms | 147388 KiB | ||||
26 | Accepted | 580ms | 163708 KiB | ||||
27 | Accepted | 586ms | 164104 KiB | ||||
28 | Accepted | 210ms | 74696 KiB | ||||
29 | Wrong answer | 48ms | 26340 KiB | ||||
30 | Wrong answer | 46ms | 25084 KiB | ||||
31 | Accepted | 37ms | 20428 KiB | ||||
subtask5 | 0/40 | ||||||
32 | Wrong answer | 233ms | 30140 KiB | ||||
33 | Accepted | 1.97s | 68996 KiB | ||||
34 | Time limit exceeded | 2.04s | 60972 KiB | ||||
35 | Time limit exceeded | 2.072s | 74592 KiB | ||||
36 | Time limit exceeded | 2.076s | 82380 KiB | ||||
37 | Time limit exceeded | 2.026s | 82444 KiB | ||||
38 | Wrong answer | 361ms | 110644 KiB | ||||
39 | Wrong answer | 588ms | 129072 KiB | ||||
40 | Accepted | 156ms | 43700 KiB | ||||
41 | Wrong answer | 170ms | 59328 KiB |