結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2019-12-13 00:43:19 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 623 bytes |
コンパイル時間 | 481 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-06-26 01:42:32 |
合計ジャッジ時間 | 6,824 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 33 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i LIST = "#{gets.chomp}#{gets.chomp}".chars.map { |c| c == 'o' ? true : false } # puts LIST.to_s def count_from(list, i) c = 0 while i < 14 && list[i] c += 1 i += 1 end c end def count(list) a = Array.new(14) do |i| count_from(list, i) end # puts "#{list} -> #{a.max}" a.max end xidxs = LIST.each_index.select { |i| !LIST[i] } # puts xidxs.to_s ans = count(LIST) xidxs.each do |start| remain = N list = LIST.map.with_index { |r, i| if i >= start && remain > 0 && !r remain -= 1 true else r end } ans = [count(list), ans].max end puts ans