結果
問題 | No.145 yukiover |
ユーザー | siman |
提出日時 | 2022-02-23 17:34:47 |
言語 | Ruby (3.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 520 bytes |
コンパイル時間 | 255 ms |
コンパイル使用メモリ | 11,464 KB |
実行使用メモリ | 27,340 KB |
最終ジャッジ日時 | 2023-09-14 10:22:40 |
合計ジャッジ時間 | 8,282 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 84 ms
15,112 KB |
testcase_01 | AC | 83 ms
15,160 KB |
testcase_02 | AC | 84 ms
15,268 KB |
testcase_03 | AC | 84 ms
15,328 KB |
testcase_04 | AC | 83 ms
15,140 KB |
testcase_05 | RE | - |
testcase_06 | AC | 83 ms
15,164 KB |
testcase_07 | AC | 81 ms
15,068 KB |
testcase_08 | AC | 81 ms
15,072 KB |
testcase_09 | AC | 81 ms
15,328 KB |
testcase_10 | RE | - |
testcase_11 | AC | 128 ms
22,532 KB |
testcase_12 | RE | - |
testcase_13 | AC | 384 ms
24,968 KB |
testcase_14 | AC | 710 ms
25,356 KB |
testcase_15 | AC | 835 ms
27,340 KB |
testcase_16 | AC | 1,051 ms
26,412 KB |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | AC | 225 ms
25,256 KB |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i S = gets.chomp.chars.sort.reverse T = 'yuki' def f(x) completed = Array.new(x, false) idx = 0 5.times do |i| x.times do |j| next if completed[j] return false if N <= idx if T[i] < S[idx] || i == 4 completed[j] = true elsif T[i] == S[idx] # NOOP else return false end idx += 1 end end true end ok = 0 ng = N + 1 while (ok - ng).abs >= 2 x = (ok + ng) / 2 if f(x) ok = x else ng = x end end puts ok