結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー ikdikd
提出日時 2017-04-12 22:31:29
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 518 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 11,308 KB
実行使用メモリ 15,500 KB
最終ジャッジ日時 2023-09-25 13:12:37
合計ジャッジ時間 5,915 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 81 ms
15,036 KB
testcase_02 AC 81 ms
15,160 KB
testcase_03 AC 81 ms
15,088 KB
testcase_04 AC 81 ms
15,024 KB
testcase_05 AC 80 ms
15,292 KB
testcase_06 AC 81 ms
15,232 KB
testcase_07 AC 80 ms
15,032 KB
testcase_08 AC 81 ms
15,068 KB
testcase_09 AC 81 ms
15,144 KB
testcase_10 AC 82 ms
15,296 KB
testcase_11 AC 83 ms
15,104 KB
testcase_12 AC 83 ms
15,268 KB
testcase_13 AC 79 ms
15,116 KB
testcase_14 AC 81 ms
15,000 KB
testcase_15 AC 80 ms
15,072 KB
testcase_16 AC 79 ms
15,084 KB
testcase_17 AC 80 ms
15,156 KB
testcase_18 AC 80 ms
15,144 KB
testcase_19 AC 80 ms
15,228 KB
testcase_20 AC 82 ms
15,360 KB
testcase_21 AC 81 ms
15,136 KB
testcase_22 AC 80 ms
15,392 KB
testcase_23 AC 81 ms
15,236 KB
testcase_24 AC 81 ms
15,164 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 81 ms
15,028 KB
testcase_29 AC 82 ms
15,132 KB
testcase_30 AC 81 ms
15,160 KB
testcase_31 AC 81 ms
15,092 KB
testcase_32 AC 82 ms
15,116 KB
testcase_33 AC 82 ms
15,232 KB
testcase_34 AC 82 ms
15,092 KB
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 81 ms
15,104 KB
testcase_38 AC 81 ms
15,104 KB
testcase_39 AC 82 ms
15,100 KB
testcase_40 RE -
testcase_41 WA -
testcase_42 AC 81 ms
15,308 KB
testcase_43 RE -
testcase_44 RE -
testcase_45 AC 81 ms
15,004 KB
testcase_46 AC 82 ms
15,084 KB
testcase_47 AC 81 ms
15,032 KB
testcase_48 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

d=gets.to_i
s=Array.new(2){gets.chomp}.inject{|s, t| s+t}

d.times{s='x'+s+'x'}
s=s.chars.each.map{|c| c=='x' ? 0 : 1}
mx=0
(s.size-d+1).times do |i|
  next unless s[i...i+d].inject(:+).zero?
  for j in i...i+d do
    s[j]^=1
  end
  l, r, cnt=0, 0, 0
  while r<s.size
    l=r
    while r<s.size and s[r].zero?
      l+=1
      r+=1
    end
    while r<s.size and s[r]==1
      r+=1
    end
    cnt=[cnt, r-l].max
  end
  # print "#{i} #{cnt}\n"
  mx=[mx, cnt].max
  for j in i...i+d do
    s[j]^=1
  end
end

puts mx
0