96902024-02-27 20:53:25birozsSzínes szobák (50 pont)python3Time limit exceeded 8/50400ms22284 KiB
#be = open("./teszt/in.12")
N,K,M = map(int,input().split())
lista = list(map(int,input().split()))
lepes = []
for i in range(M):
    szin,irany = map(int,input().split())
    lepes.append([szin,irany])
#be.close()
db = 0
for i in range(N):
    poz = i
    for j in range(M):
        if lista[poz] == lepes[j][0]:
            poz = poz + lepes[j][1]
            if poz < 0 or poz > N-1:
                db += 1
                break
print(db)
SubtaskSumTestVerdictTimeMemory
base8/50
1Accepted0/017ms11232 KiB
2Time limit exceeded0/0400ms20160 KiB
3Accepted1/1239ms12016 KiB
4Accepted1/1248ms11844 KiB
5Accepted1/1256ms12140 KiB
6Accepted1/1234ms12308 KiB
7Accepted1/1238ms12132 KiB
8Accepted1/1228ms12400 KiB
9Accepted1/1230ms12600 KiB
10Time limit exceeded0/1349ms5208 KiB
11Accepted1/1234ms12900 KiB
12Time limit exceeded0/1363ms5356 KiB
13Time limit exceeded0/1370ms6476 KiB
14Time limit exceeded0/1370ms5900 KiB
15Time limit exceeded0/1375ms5940 KiB
16Time limit exceeded0/1363ms6492 KiB
17Time limit exceeded0/1368ms7008 KiB
18Time limit exceeded0/1375ms7292 KiB
19Time limit exceeded0/1316ms17400 KiB
20Time limit exceeded0/1372ms21460 KiB
21Time limit exceeded0/1381ms17480 KiB
22Time limit exceeded0/1352ms18180 KiB
23Time limit exceeded0/1372ms20584 KiB
24Time limit exceeded0/1368ms21960 KiB
25Time limit exceeded0/1372ms22132 KiB
26Time limit exceeded0/1365ms22284 KiB
27Time limit exceeded0/3379ms19836 KiB
28Time limit exceeded0/3384ms19700 KiB
29Time limit exceeded0/3349ms19844 KiB
30Time limit exceeded0/3384ms19880 KiB
31Time limit exceeded0/3384ms19828 KiB
32Time limit exceeded0/3388ms19828 KiB
33Time limit exceeded0/4379ms13692 KiB
34Time limit exceeded0/4372ms19104 KiB