結果
| 問題 |
No.1512 作文
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-21 21:33:32 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 415 bytes |
| コンパイル時間 | 460 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 29,824 KB |
| 最終ジャッジ日時 | 2024-10-10 07:58:52 |
| 合計ジャッジ時間 | 14,890 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 37 TLE * 1 |
コンパイルメッセージ
Main.rb:22: warning: assigned but unused variable - ans Syntax OK
ソースコード
N = gets.to_i
a = ?a.ord
S = []
def good?(s)
c = s[0]
s.each_char.all? { |d|
x = c <= d
c = d
x
}
end
N.times do
s = gets.chomp
next unless good?(s)
S << [s[0].ord - a, s[-1].ord - a, s.size]
end
S.sort!
ans = 0
A = Array.new(26, 0)
S.each do |(f, l, s)|
x = A[f]
y = x + s
(l ... 26).each do |i|
A[i] = y if y > A[i]
end
end
puts A.max