89272024-02-05 17:11:27NagyLeoSzínes szobák (50 pont)python3Time limit exceeded 7/50400ms19388 KiB
def main():
    N, K, M = map(int, input().split())
    rooms_raw = list(map(int, input().split()))
    rooms = []

    for i in rooms_raw:
        rooms.append([i, 1])

    left_people = 0
    for i in range(M):
        color, direct = map(int, input().split())

        for j in range(N):
            if rooms[j][0] == color:
                if j + direct > N - 1 or j + direct < 0:
                    left_people += rooms[j][1]
                    rooms[j][1] = 0
                else:
                    rooms[j + direct][1] += rooms[j][1]
                    rooms[j][1] = 0
    print(left_people)

main()
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/017ms11412 KiB
2Time limit exceeded0/0368ms17028 KiB
3Accepted1/1229ms12084 KiB
4Accepted1/1234ms12124 KiB
5Accepted1/1226ms12308 KiB
6Accepted1/1239ms12320 KiB
7Accepted1/1231ms12412 KiB
8Accepted1/1226ms12724 KiB
9Accepted1/1224ms12868 KiB
10Time limit exceeded0/1377ms5344 KiB
11Wrong answer0/1224ms12964 KiB
12Time limit exceeded0/1368ms5460 KiB
13Time limit exceeded0/1370ms5800 KiB
14Time limit exceeded0/1379ms6376 KiB
15Time limit exceeded0/1375ms6492 KiB
16Time limit exceeded0/1347ms6520 KiB
17Time limit exceeded0/1367ms6632 KiB
18Time limit exceeded0/1379ms6700 KiB
19Time limit exceeded0/1356ms18812 KiB
20Time limit exceeded0/1381ms18848 KiB
21Time limit exceeded0/1372ms18880 KiB
22Time limit exceeded0/1381ms18924 KiB
23Time limit exceeded0/1400ms19024 KiB
24Time limit exceeded0/1365ms19080 KiB
25Time limit exceeded0/1372ms19304 KiB
26Time limit exceeded0/1388ms19388 KiB
27Time limit exceeded0/3381ms17724 KiB
28Time limit exceeded0/3372ms17604 KiB
29Time limit exceeded0/3360ms17688 KiB
30Time limit exceeded0/3384ms17600 KiB
31Time limit exceeded0/3368ms17652 KiB
32Time limit exceeded0/3365ms17592 KiB
33Time limit exceeded0/4368ms12028 KiB
34Time limit exceeded0/4372ms12172 KiB