結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー te-sh
提出日時 2017-05-11 14:10:50
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 464 bytes
コンパイル時間 835 ms
コンパイル使用メモリ 106,872 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 19:09:56
合計ジャッジ時間 2,190 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto d = readln.chomp.to!int;
  auto wd = 'x'.repeat.take(d).array, hd = 'o'.repeat.take(d).array;
  auto s1 = readln.chomp, s2 = readln.chomp, s = wd ~ s1 ~ s2 ~ wd;

  auto r = 0;
  foreach (i; 0..s.length-d) {
    if (s[i..i+d] == wd) {
      auto t = s.dup;
      t[i..i+d] = hd;
      r = max(r, t.group.filter!"a[0] == 'o'".map!"a[1]".maxElement);
    }
  }

  writeln(r);
}
0