結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-20 00:29:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 21 ms / 1,000 ms |
| コード長 | 755 bytes |
| コンパイル時間 | 1,791 ms |
| コンパイル使用メモリ | 194,624 KB |
| 最終ジャッジ日時 | 2025-01-06 20:30:23 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
string r = "xxxxxxxxxxxxxxxx";
int d;
cin >> d;
string s;
for (int i = 0; i < 2; i++) {
string t;
cin >> t;
s += t;
}
s = r + s + r;
int len = (int) s.length();
int ans = 0;
for (int i = 0; i <= len - d; i++) {
int cnt = 0;
int t = 0;
for (int j = 0; j < d; j++) {
if (t == 0 && s[i + j] == 'x') t++;
if (t == 1 && s[i + j] == 'o') t++;
if (t == 2 && s[i + j] == 'x') t++;
}
if(t == 3) continue;
for (int j = 0; j < len; j++) {
if(i <= j && j < i + d) cnt++;
else {
if(s[j] == 'o') cnt++;
else cnt = 0;
}
ans = max(ans, cnt);
}
}
cout << ans << endl;
return 0;
}