結果

問題 No.1512 作文
ユーザー maguroflymagurofly
提出日時 2021-05-21 21:33:32
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,930 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 535 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 29,824 KB
最終ジャッジ日時 2024-04-18 14:43:28
合計ジャッジ時間 13,548 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
12,288 KB
testcase_01 AC 87 ms
12,032 KB
testcase_02 AC 83 ms
12,288 KB
testcase_03 AC 77 ms
12,288 KB
testcase_04 AC 1,074 ms
22,016 KB
testcase_05 AC 1,091 ms
21,760 KB
testcase_06 AC 1,148 ms
22,016 KB
testcase_07 AC 1,189 ms
21,888 KB
testcase_08 AC 1,086 ms
22,016 KB
testcase_09 AC 82 ms
12,160 KB
testcase_10 AC 74 ms
12,160 KB
testcase_11 AC 74 ms
12,032 KB
testcase_12 AC 84 ms
12,160 KB
testcase_13 AC 82 ms
12,032 KB
testcase_14 AC 129 ms
12,416 KB
testcase_15 AC 133 ms
12,416 KB
testcase_16 AC 127 ms
12,544 KB
testcase_17 AC 137 ms
12,416 KB
testcase_18 AC 127 ms
12,544 KB
testcase_19 AC 131 ms
12,416 KB
testcase_20 AC 129 ms
12,416 KB
testcase_21 AC 85 ms
12,160 KB
testcase_22 AC 76 ms
12,160 KB
testcase_23 AC 77 ms
12,160 KB
testcase_24 AC 81 ms
12,288 KB
testcase_25 AC 80 ms
12,160 KB
testcase_26 AC 77 ms
12,288 KB
testcase_27 AC 76 ms
12,160 KB
testcase_28 AC 77 ms
12,288 KB
testcase_29 AC 82 ms
12,160 KB
testcase_30 AC 83 ms
12,288 KB
testcase_31 AC 82 ms
12,032 KB
testcase_32 AC 89 ms
12,288 KB
testcase_33 AC 83 ms
12,288 KB
testcase_34 AC 86 ms
12,544 KB
testcase_35 AC 127 ms
12,672 KB
testcase_36 AC 132 ms
12,672 KB
testcase_37 AC 109 ms
12,416 KB
testcase_38 AC 147 ms
12,416 KB
testcase_39 AC 144 ms
12,416 KB
testcase_40 AC 1,930 ms
29,824 KB
testcase_41 AC 1,343 ms
29,824 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:22: warning: assigned but unused variable - ans
Syntax OK

ソースコード

diff #

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
0