2827 | 2023-01-28 16:13:43 | VMGoJo | Videójáték | python3 | Time limit exceeded 0/100 | 2.085s | 163760 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 | 17ms | 11544 KiB | ||||
2 | Accepted | 17ms | 11764 KiB | ||||
subtask2 | 0/10 | ||||||
3 | Accepted | 17ms | 11988 KiB | ||||
4 | Accepted | 61ms | 12068 KiB | ||||
5 | Accepted | 17ms | 12380 KiB | ||||
6 | Accepted | 18ms | 12636 KiB | ||||
7 | Accepted | 17ms | 12504 KiB | ||||
8 | Accepted | 474ms | 12684 KiB | ||||
9 | Accepted | 17ms | 12880 KiB | ||||
10 | Accepted | 1.042s | 13156 KiB | ||||
11 | Time limit exceeded | 2.078s | 5348 KiB | ||||
subtask3 | 0/20 | ||||||
12 | Accepted | 17ms | 13076 KiB | ||||
13 | Accepted | 83ms | 12944 KiB | ||||
14 | Time limit exceeded | 2.066s | 5580 KiB | ||||
15 | Accepted | 18ms | 13852 KiB | ||||
16 | Accepted | 19ms | 14272 KiB | ||||
17 | Time limit exceeded | 2.062s | 6668 KiB | ||||
18 | Time limit exceeded | 2.071s | 6640 KiB | ||||
19 | Time limit exceeded | 2.066s | 7152 KiB | ||||
20 | Wrong answer | 20ms | 15232 KiB | ||||
21 | Wrong answer | 21ms | 15696 KiB | ||||
22 | Wrong answer | 18ms | 14708 KiB | ||||
subtask4 | 0/30 | ||||||
23 | Accepted | 67ms | 29084 KiB | ||||
24 | Accepted | 217ms | 63064 KiB | ||||
25 | Accepted | 493ms | 147308 KiB | ||||
26 | Accepted | 663ms | 163760 KiB | ||||
27 | Accepted | 670ms | 163696 KiB | ||||
28 | Accepted | 211ms | 74476 KiB | ||||
29 | Wrong answer | 46ms | 25616 KiB | ||||
30 | Wrong answer | 48ms | 25152 KiB | ||||
31 | Accepted | 35ms | 20368 KiB | ||||
subtask5 | 0/40 | ||||||
32 | Wrong answer | 237ms | 29976 KiB | ||||
33 | Accepted | 1.95s | 68912 KiB | ||||
34 | Time limit exceeded | 2.036s | 60712 KiB | ||||
35 | Time limit exceeded | 2.081s | 74104 KiB | ||||
36 | Time limit exceeded | 2.069s | 81868 KiB | ||||
37 | Time limit exceeded | 2.085s | 81916 KiB | ||||
38 | Wrong answer | 384ms | 110256 KiB | ||||
39 | Wrong answer | 635ms | 128764 KiB | ||||
40 | Accepted | 158ms | 43324 KiB | ||||
41 | Wrong answer | 170ms | 58996 KiB |