結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-16 11:51:41 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 689 bytes |
| コンパイル時間 | 9,465 ms |
| コンパイル使用メモリ | 310,612 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-12 04:27:23 |
| 合計ジャッジ時間 | 8,725 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
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) {
auto di = ci.dup;
if (c != 'o') {
auto s = ci[i..$].countUntil!(a => a == 'o');
if (s == -1) s = ci.length - i;
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);
}