結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-11 14:15:47 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 536 bytes |
| コンパイル時間 | 1,061 ms |
| コンパイル使用メモリ | 107,208 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-12 19:10:19 |
| 合計ジャッジ時間 | 2,112 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 42 WA * 4 |
ソースコード
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-cd+1) {
if (ts[i..i+cd] == wd) {
auto t = ts.dup;
t[i..i+cd] = hd;
r = max(r, t.group.filter!"a[0] == 'o'".map!"a[1]".maxElement);
}
}
}
writeln(r);
}