結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
|
提出日時 | 2017-05-11 14:14:58 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 533 bytes |
コンパイル時間 | 602 ms |
コンパイル使用メモリ | 109,152 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 19:10:00 |
合計ジャッジ時間 | 1,667 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 36 WA * 10 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; void main() { auto d = readln.chomp.to!int; auto s1 = readln.chomp, s2 = readln.chomp, s = s1 ~ s2; auto r = 0; foreach (cd; 1..d+1) { auto wd = 'x'.repeat.take(cd).array, hd = 'o'.repeat.take(cd).array; auto ts = wd ~ s ~ wd; foreach (i; 0..ts.length-d+1) { if (ts[i..i+d] == wd) { auto t = ts.dup; t[i..i+d] = hd; r = max(r, t.group.filter!"a[0] == 'o'".map!"a[1]".maxElement); } } } writeln(r); }