結果
| 問題 |
No.1512 作文
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2021-05-23 18:24:48 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 362 bytes |
| コンパイル時間 | 49 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 34,560 KB |
| 最終ジャッジ日時 | 2024-10-11 22:35:43 |
| 合計ジャッジ時間 | 16,894 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 36 TLE * 2 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i
S = N.times.map { gets.chomp }
T = S.select { |s| s.chars.each_cons(2).all? { |a, b| a <= b } }.sort
dp = Hash.new(0)
T.each do |t|
i = t[0]
j = t[-1]
('a'..i).to_a.reverse_each do |c|
len = dp[c] + t.size
if dp[j] < len
dp[j] = len
end
end
end
values = dp.values
if values.empty?
puts 0
else
puts values.max
end
siman