結果

問題 No.145 yukiover
ユーザー yuruhiyayuruhiya
提出日時 2021-07-12 17:10:55
言語 Crystal
(1.11.2)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 441 bytes
コンパイル時間 17,647 ms
コンパイル使用メモリ 254,836 KB
実行使用メモリ 4,796 KB
最終ジャッジ日時 2023-09-14 20:40:30
合計ジャッジ時間 18,840 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,480 KB
testcase_01 AC 2 ms
4,452 KB
testcase_02 AC 3 ms
4,488 KB
testcase_03 AC 3 ms
4,496 KB
testcase_04 AC 3 ms
4,396 KB
testcase_05 AC 3 ms
4,496 KB
testcase_06 AC 3 ms
4,432 KB
testcase_07 AC 3 ms
4,468 KB
testcase_08 AC 2 ms
4,512 KB
testcase_09 AC 3 ms
4,448 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 7 ms
4,712 KB
testcase_12 AC 9 ms
4,552 KB
testcase_13 AC 10 ms
4,696 KB
testcase_14 AC 10 ms
4,700 KB
testcase_15 AC 9 ms
4,560 KB
testcase_16 AC 8 ms
4,608 KB
testcase_17 AC 10 ms
4,632 KB
testcase_18 AC 9 ms
4,648 KB
testcase_19 AC 9 ms
4,796 KB
testcase_20 AC 9 ms
4,648 KB
testcase_21 AC 10 ms
4,708 KB
testcase_22 AC 10 ms
4,696 KB
testcase_23 AC 9 ms
4,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(cnt, ind)
  x = ind.tally.min_of { |elem, c| cnt[elem] // c }
  ind.each { |i| cnt[i] -= x }
  x
end

n = read_line.to_i
s = read_line
cnt = [s.count('z'), s.count('y'), s.count("v-x"), s.count('u'), s.count("l-t"), s.count('k'), s.count('j'), s.count('i'), s.count("a-h")]

puts [
  [0],
  [1, 2],
  [1, 3, 4],
  [1, 3, 5, 6],
  [1, 3, 5, 7, 8],
  [1, 3, 5, 7, 7],
  [1, 3, 5, 5],
  [1, 3, 3],
  [1, 1],
].sum { |ind|
  f(cnt, ind)
}
0