結果

問題 No.145 yukiover
ユーザー simansiman
提出日時 2022-02-23 17:13:05
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 724 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 11,188 KB
実行使用メモリ 28,116 KB
最終ジャッジ日時 2023-09-14 09:37:40
合計ジャッジ時間 6,003 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
15,048 KB
testcase_01 AC 75 ms
15,152 KB
testcase_02 AC 72 ms
15,088 KB
testcase_03 AC 72 ms
15,140 KB
testcase_04 AC 72 ms
15,040 KB
testcase_05 AC 74 ms
15,272 KB
testcase_06 AC 71 ms
15,276 KB
testcase_07 AC 73 ms
15,152 KB
testcase_08 WA -
testcase_09 AC 77 ms
15,060 KB
testcase_10 WA -
testcase_11 AC 246 ms
28,116 KB
testcase_12 AC 246 ms
26,408 KB
testcase_13 AC 244 ms
25,356 KB
testcase_14 AC 227 ms
24,980 KB
testcase_15 WA -
testcase_16 AC 169 ms
24,276 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 241 ms
25,672 KB
testcase_20 AC 240 ms
25,884 KB
testcase_21 WA -
testcase_22 AC 245 ms
25,900 KB
testcase_23 AC 267 ms
25,900 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
S = gets.chomp.chars.sort.reverse
T = 'yuki'
queue = S

ans = 0
stock = []

5.times do |i|
  next_que = []
  next_stock = []

  until queue.empty?
    s = queue.shift

    if i == 4
      if stock.size > 0
        ans += 1
        stock.shift
      end

      next
    end

    if T[i] > s
      next_que << s
      next
    end

    if T[i] < s
      if i == 0
        ans += 1
      elsif stock.size > 0
        ans += 1
        stock.shift
      end
    else
      if i == 0
        next_stock << s
      elsif stock.size > 0
        str = stock.shift
        str << s
        next_stock << str
      else
        next_que << s
      end
    end
  end

  queue = next_que
  stock = next_stock
end

puts ans
0