Submission #588526

# Submission time Handle Problem Language Result Execution time Memory
588526 2022-07-03T13:12:06 Z Vandflaske Martian DNA (BOI18_dna) Python 3
16 / 100
2000 ms 27548 KB
import sys
n, k, r = map(int, sys.stdin.readline().split())
dna = list(map(int, sys.stdin.readline().split()))
antal = []
tal = []
copi = []
maxi = n+1

for _ in range(r):
    b, q = map(int, sys.stdin.readline().split())
    tal.append(b)
    antal.append(q)
    copi.append(q)

B = []
for _ in range(r):
    B.append(0)




for j in range(n):
    h = 0
    for i in range(j, n):
        h += 1
        if dna[i] in tal:
            if antal[tal.index(dna[i])] != 0:
                antal[tal.index(dna[i])] -=1
            if antal == B:
                if h < maxi:
                    maxi = h
    antal = copi.copy()

if maxi == n+1:
    sys.stdout.writelines("impossible")
else:
    sys.stdout.writelines(str(maxi))
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2900 KB Output is correct
2 Correct 16 ms 2908 KB Output is correct
3 Correct 17 ms 2900 KB Output is correct
4 Correct 14 ms 2896 KB Output is correct
5 Correct 15 ms 2880 KB Output is correct
6 Correct 14 ms 2920 KB Output is correct
7 Correct 14 ms 2920 KB Output is correct
8 Correct 13 ms 2844 KB Output is correct
9 Correct 14 ms 2876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2071 ms 2908 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2065 ms 6424 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2064 ms 27548 KB Time limit exceeded
2 Halted 0 ms 0 KB -