Submission #588526

#TimeUsernameProblemLanguageResultExecution timeMemory
588526Vandflaske Martian DNA (BOI18_dna)Cpython 3
16 / 100
2071 ms27548 KiB
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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...