2983 | 2023-02-07 09:32:34 | lacito | Videójáték | python3 | Time limit exceeded 0/100 | 2.099s | 163944 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) -> 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 | 11820 KiB | ||||
2 | Accepted | 18ms | 12348 KiB | ||||
subtask2 | 0/10 | ||||||
3 | Accepted | 17ms | 12360 KiB | ||||
4 | Accepted | 57ms | 12416 KiB | ||||
5 | Accepted | 17ms | 12584 KiB | ||||
6 | Accepted | 19ms | 13032 KiB | ||||
7 | Accepted | 17ms | 13200 KiB | ||||
8 | Accepted | 453ms | 13224 KiB | ||||
9 | Accepted | 17ms | 13468 KiB | ||||
10 | Accepted | 996ms | 13416 KiB | ||||
11 | Time limit exceeded | 2.069s | 5824 KiB | ||||
subtask3 | 0/20 | ||||||
12 | Accepted | 18ms | 13556 KiB | ||||
13 | Accepted | 82ms | 13904 KiB | ||||
14 | Time limit exceeded | 2.053s | 6328 KiB | ||||
15 | Accepted | 19ms | 14304 KiB | ||||
16 | Accepted | 19ms | 14348 KiB | ||||
17 | Time limit exceeded | 2.099s | 6780 KiB | ||||
18 | Time limit exceeded | 2.062s | 7228 KiB | ||||
19 | Time limit exceeded | 2.058s | 7256 KiB | ||||
20 | Wrong answer | 23ms | 15560 KiB | ||||
21 | Wrong answer | 24ms | 15620 KiB | ||||
22 | Wrong answer | 18ms | 14960 KiB | ||||
subtask4 | 0/30 | ||||||
23 | Accepted | 68ms | 29404 KiB | ||||
24 | Accepted | 218ms | 63408 KiB | ||||
25 | Accepted | 490ms | 147484 KiB | ||||
26 | Accepted | 583ms | 163944 KiB | ||||
27 | Accepted | 580ms | 163808 KiB | ||||
28 | Accepted | 209ms | 74476 KiB | ||||
29 | Wrong answer | 46ms | 26088 KiB | ||||
30 | Wrong answer | 48ms | 25240 KiB | ||||
31 | Accepted | 37ms | 20392 KiB | ||||
subtask5 | 0/40 | ||||||
32 | Wrong answer | 231ms | 30148 KiB | ||||
33 | Accepted | 1.907s | 69236 KiB | ||||
34 | Time limit exceeded | 2.063s | 61124 KiB | ||||
35 | Time limit exceeded | 2.081s | 74728 KiB | ||||
36 | Time limit exceeded | 2.072s | 82256 KiB | ||||
37 | Time limit exceeded | 2.072s | 82332 KiB | ||||
38 | Wrong answer | 351ms | 110756 KiB | ||||
39 | Wrong answer | 629ms | 129076 KiB | ||||
40 | Accepted | 155ms | 43440 KiB | ||||
41 | Wrong answer | 172ms | 59324 KiB |