結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 81 ms
15,000 KB
testcase_02 AC 80 ms
15,244 KB
testcase_03 AC 81 ms
15,280 KB
testcase_04 AC 80 ms
15,336 KB
testcase_05 AC 81 ms
15,064 KB
testcase_06 AC 81 ms
15,028 KB
testcase_07 AC 82 ms
15,272 KB
testcase_08 AC 81 ms
15,136 KB
testcase_09 AC 81 ms
15,092 KB
testcase_10 AC 81 ms
15,064 KB
testcase_11 AC 81 ms
15,220 KB
testcase_12 AC 81 ms
15,128 KB
testcase_13 AC 81 ms
15,124 KB
testcase_14 AC 81 ms
15,244 KB
testcase_15 AC 81 ms
15,104 KB
testcase_16 AC 83 ms
15,020 KB
testcase_17 AC 82 ms
15,136 KB
testcase_18 AC 80 ms
15,148 KB
testcase_19 AC 80 ms
15,068 KB
testcase_20 AC 81 ms
15,068 KB
testcase_21 AC 81 ms
15,236 KB
testcase_22 WA -
testcase_23 AC 80 ms
15,336 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 80 ms
15,104 KB
testcase_29 AC 84 ms
15,284 KB
testcase_30 AC 83 ms
15,004 KB
testcase_31 AC 82 ms
15,244 KB
testcase_32 AC 82 ms
15,240 KB
testcase_33 AC 81 ms
15,128 KB
testcase_34 AC 82 ms
15,096 KB
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 82 ms
15,136 KB
testcase_38 AC 82 ms
15,260 KB
testcase_39 AC 82 ms
15,196 KB
testcase_40 RE -
testcase_41 WA -
testcase_42 AC 81 ms
15,236 KB
testcase_43 RE -
testcase_44 RE -
testcase_45 AC 82 ms
15,256 KB
testcase_46 AC 81 ms
15,288 KB
testcase_47 WA -
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).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