結果

問題 No.1512 作文
ユーザー simansiman
提出日時 2021-05-23 18:24:48
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 362 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 34,816 KB
最終ジャッジ日時 2024-04-20 03:41:54
合計ジャッジ時間 14,497 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
12,160 KB
testcase_01 AC 78 ms
12,160 KB
testcase_02 AC 78 ms
12,160 KB
testcase_03 AC 80 ms
12,160 KB
testcase_04 AC 950 ms
24,448 KB
testcase_05 AC 935 ms
26,880 KB
testcase_06 AC 954 ms
26,880 KB
testcase_07 AC 973 ms
26,880 KB
testcase_08 AC 932 ms
26,880 KB
testcase_09 AC 97 ms
13,184 KB
testcase_10 AC 111 ms
15,232 KB
testcase_11 AC 104 ms
13,440 KB
testcase_12 AC 99 ms
14,848 KB
testcase_13 AC 101 ms
14,976 KB
testcase_14 AC 154 ms
13,952 KB
testcase_15 AC 158 ms
13,824 KB
testcase_16 AC 153 ms
13,824 KB
testcase_17 AC 158 ms
13,824 KB
testcase_18 AC 153 ms
13,952 KB
testcase_19 AC 162 ms
13,824 KB
testcase_20 AC 158 ms
13,824 KB
testcase_21 AC 82 ms
12,544 KB
testcase_22 AC 78 ms
12,160 KB
testcase_23 AC 78 ms
12,672 KB
testcase_24 AC 80 ms
12,544 KB
testcase_25 AC 82 ms
12,672 KB
testcase_26 AC 79 ms
12,416 KB
testcase_27 AC 80 ms
12,160 KB
testcase_28 AC 76 ms
12,288 KB
testcase_29 AC 78 ms
12,288 KB
testcase_30 AC 77 ms
12,416 KB
testcase_31 AC 78 ms
12,544 KB
testcase_32 AC 80 ms
12,416 KB
testcase_33 AC 79 ms
12,160 KB
testcase_34 AC 87 ms
12,800 KB
testcase_35 AC 183 ms
27,008 KB
testcase_36 AC 184 ms
27,008 KB
testcase_37 AC 137 ms
20,608 KB
testcase_38 AC 157 ms
12,928 KB
testcase_39 AC 156 ms
13,312 KB
testcase_40 AC 1,690 ms
34,816 KB
testcase_41 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
S = N.times.map { gets.chomp }
T = S.select { |s| s.chars.each_cons(2).all? { |a, b| a <= b } }.sort
dp = Hash.new(0)

T.each do |t|
  i = t[0]
  j = t[-1]

  ('a'..i).to_a.reverse_each do |c|
    len = dp[c] + t.size

    if dp[j] < len
      dp[j] = len
    end
  end
end

values = dp.values

if values.empty?
  puts 0
else
  puts values.max
end
0