結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー te-sh
提出日時 2016-09-16 11:45:27
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 685 bytes
コンパイル時間 9,621 ms
コンパイル使用メモリ 311,248 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 04:27:12
合計ジャッジ時間 9,436 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.regex, std.conv, std.stdio, std.typecons;

void main()
{
  auto d = readln.chomp.to!int;
  auto c1 = readln.chomp;
  auto c2 = readln.chomp;

  auto ci = 'x'.repeat(d).to!string ~ c1 ~ c2 ~ 'x'.repeat(d).to!string;
  auto r = 0;
  foreach (i, c; ci) {
    if (c == 'o') continue;
    auto s = ci[i..$].countUntil!(a => a == 'o');
    if (s == -1) s = ci.length - i;
    auto di = ci.dup;
    di[i..i + min(d, s)] = 'o';
    r = max(r, di.splitter(regex(r"x+")).map!(a => a.length).reduce!(max).to!int);
  }
  writeln(r);
}
0