結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
izryt(趣味)
|
| 提出日時 | 2016-01-14 04:56:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 761 bytes |
| コンパイル時間 | 632 ms |
| コンパイル使用メモリ | 57,688 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 13:50:29 |
| 合計ジャッジ時間 | 1,910 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 WA * 11 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int f(string a)
{
a += "x";
int ma = 0;
bool st = true;
int s;
for (int i = 0; i < a.size(); ++i) {
if (st && a[i] == 'o') {
s = i;
st = false;
} else if (!st && a[i] == 'x') {
ma = max(ma, i - s);
st = true;
}
}
return ma;
}
int main()
{
int d; cin >> d;
string a = "xxxxxxxxxxxxxx";
string s = "";
for (int i = 0; i < 2; ++i) { string t; cin >> t; s += t; }
s = a + s + a;
int ma = 0;
for (int i = 0; i < s.size() - 14; ++i) {
string t = s;
for (int j = 0; j < d; ++j) t[i+j] = 'o';
ma = max(ma, f(t));
}
cout << ma << endl;
}
izryt(趣味)