結果
問題 |
No.1512 作文
|
ユーザー |
|
提出日時 | 2021-05-21 21:50:27 |
言語 | Crystal (1.14.0) |
結果 |
AC
|
実行時間 | 61 ms / 2,000 ms |
コード長 | 474 bytes |
コンパイル時間 | 11,150 ms |
コンパイル使用メモリ | 295,740 KB |
実行使用メモリ | 12,792 KB |
最終ジャッジ日時 | 2024-10-10 08:21:48 |
合計ジャッジ時間 | 12,668 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 38 |
ソースコード
N = gets.to_s.to_i a = 'a'.ord S = [] of {Int32, Int32, Int32} def good?(s) c = s[0] s.each_char.all? { |d| x = c <= d c = d x } end N.times do s = gets.to_s.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 |t| f, l, s = t[0], t[1], t[2] x = A[f] y = x + s (l ... 26).each do |i| A[i] = y if y > A[i] end end puts A.max