結果

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

ソースコード

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+1) {
    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