結果
| 問題 | No.3427 Erasing a Subsequence |
| コンテスト | |
| ユーザー |
kidodesu
|
| 提出日時 | 2025-12-29 18:34:55 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 388 ms / 2,000 ms |
| コード長 | 458 bytes |
| 記録 | |
| コンパイル時間 | 151 ms |
| コンパイル使用メモリ | 82,924 KB |
| 実行使用メモリ | 245,108 KB |
| 最終ジャッジ日時 | 2026-01-11 13:04:36 |
| 合計ジャッジ時間 | 2,333 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
n, m = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
dp = [-1] * (m+1)
dp[0] = []
for y in range(n):
ndp = [-1] * (m+1)
for x in range(m+1):
if dp[x] == -1:
break
if ndp[x] != -1:
ndp[x] = min(ndp[x], dp[x]+[S[y]])
else:
ndp[x] = dp[x]+[S[y]]
if x < m and S[y] == T[x]:
ndp[x+1] = dp[x][:]
dp = ndp
print(*dp[-1])
kidodesu