結果

問題 No.1512 作文
ユーザー maguroflymagurofly
提出日時 2021-05-21 21:50:27
言語 Crystal
(1.11.2)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 14,507 ms
コンパイル使用メモリ 294,344 KB
実行使用メモリ 13,172 KB
最終ジャッジ日時 2024-04-18 15:06:16
合計ジャッジ時間 13,869 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,820 KB
testcase_02 AC 2 ms
6,812 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 40 ms
7,168 KB
testcase_05 AC 38 ms
8,064 KB
testcase_06 AC 39 ms
8,064 KB
testcase_07 AC 40 ms
8,064 KB
testcase_08 AC 39 ms
7,808 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 5 ms
6,940 KB
testcase_15 AC 5 ms
6,940 KB
testcase_16 AC 5 ms
6,940 KB
testcase_17 AC 6 ms
6,944 KB
testcase_18 AC 6 ms
6,940 KB
testcase_19 AC 6 ms
6,940 KB
testcase_20 AC 5 ms
6,940 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 1 ms
6,944 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,944 KB
testcase_33 AC 2 ms
6,944 KB
testcase_34 AC 2 ms
6,944 KB
testcase_35 AC 3 ms
6,940 KB
testcase_36 AC 3 ms
6,944 KB
testcase_37 AC 3 ms
6,940 KB
testcase_38 AC 3 ms
6,940 KB
testcase_39 AC 3 ms
6,944 KB
testcase_40 AC 61 ms
11,896 KB
testcase_41 AC 40 ms
13,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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
0