답안 #588526

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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))
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2071 ms 2908 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2065 ms 6424 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2064 ms 27548 KB Time limit exceeded
2 Halted 0 ms 0 KB -