結果
| 問題 | No.1029 JJOOII 3 |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2020-04-17 21:41:32 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 474 bytes |
| 記録 | |
| コンパイル時間 | 80 ms |
| コンパイル使用メモリ | 80,512 KB |
| 実行使用メモリ | 87,936 KB |
| 最終ジャッジ日時 | 2026-09-09 15:26:38 |
| 合計ジャッジ時間 | 51,281 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 RE * 4 TLE * 14 -- * 8 |
ソースコード
import sys
input = sys.stdin.readline
N,K=map(int,input().split())
S=[input().split() for i in range(N)]
DP=[1<<63]*(K+2+100)
DP[0]=0
T="J"*K+"O"*K+"I"*K
for i in range(len(T)):
NEXT=T[i:i+80]
for j in range(N):
ind=0
M=int(S[j][1])
for s in S[j][0]:
if ind<len(NEXT) and s==NEXT[ind]:
ind+=1
DP[i+ind]=min(DP[i+ind],DP[i]+M)
if 1<<63==DP[K*3]:
print(-1)
else:
print(DP[K*3])
titia