結果

問題 No.1512 作文
ユーザー maguroflymagurofly
提出日時 2021-05-21 21:30:15
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 428 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 37,760 KB
最終ジャッジ日時 2024-04-18 14:35:35
合計ジャッジ時間 16,161 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
12,416 KB
testcase_01 AC 89 ms
12,288 KB
testcase_02 AC 89 ms
12,160 KB
testcase_03 AC 89 ms
12,160 KB
testcase_04 AC 1,252 ms
23,424 KB
testcase_05 AC 1,283 ms
23,296 KB
testcase_06 AC 1,279 ms
23,296 KB
testcase_07 AC 1,273 ms
23,424 KB
testcase_08 AC 1,269 ms
23,296 KB
testcase_09 AC 138 ms
13,568 KB
testcase_10 AC 139 ms
14,080 KB
testcase_11 AC 136 ms
13,824 KB
testcase_12 AC 137 ms
13,952 KB
testcase_13 AC 140 ms
13,824 KB
testcase_14 AC 204 ms
16,256 KB
testcase_15 AC 206 ms
16,256 KB
testcase_16 AC 208 ms
16,256 KB
testcase_17 AC 208 ms
16,384 KB
testcase_18 AC 205 ms
16,256 KB
testcase_19 AC 218 ms
16,256 KB
testcase_20 AC 203 ms
16,384 KB
testcase_21 AC 96 ms
12,544 KB
testcase_22 AC 91 ms
12,160 KB
testcase_23 AC 95 ms
12,544 KB
testcase_24 AC 97 ms
12,544 KB
testcase_25 AC 98 ms
12,544 KB
testcase_26 AC 88 ms
12,160 KB
testcase_27 AC 90 ms
12,288 KB
testcase_28 AC 89 ms
12,160 KB
testcase_29 AC 89 ms
12,160 KB
testcase_30 AC 89 ms
12,288 KB
testcase_31 AC 92 ms
12,288 KB
testcase_32 AC 93 ms
12,416 KB
testcase_33 AC 89 ms
12,160 KB
testcase_34 AC 99 ms
12,800 KB
testcase_35 AC 156 ms
14,848 KB
testcase_36 AC 157 ms
14,848 KB
testcase_37 AC 131 ms
13,952 KB
testcase_38 AC 157 ms
13,952 KB
testcase_39 AC 158 ms
14,080 KB
testcase_40 TLE -
testcase_41 AC 1,404 ms
37,504 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:20: warning: assigned but unused variable - ans
Syntax OK

ソースコード

diff #

N = gets.to_i
a = ?a.ord
S = Array.new(N) { gets.chomp.each_char.map { |c| c.ord - a } }

def good?(s)
    c = s[0]
    s.all? { |d|
        x = c <= d
        c = d
        x
    }
end

S.filter! { |s| good?(s) }

S.map! { |s| [s[0], s[-1], s.size] }

S.sort!

ans = 0

A = Hash.new(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.values.max || 0
0