結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
|
提出日時 | 2019-01-20 00:14:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 731 bytes |
コンパイル時間 | 1,554 ms |
コンパイル使用メモリ | 168,812 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 12:22:17 |
合計ジャッジ時間 | 3,032 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 WA * 2 |
ソースコード
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); string s; for (int i = 0; i < 14; i++) { s += 'x'; } int d; cin >> d; for (int i = 0; i < 2; i++) { string t; cin >> t; s += t; } for (int i = 0; i < 14; i++) { s += 'x'; } int ans = 0; int len = (int) s.length(); for (int i = 0; i < len; i++) { int cnt = 0; bool valid = true; for (int j = 1; j < d - 1; j++ ) { if(s[j + i] == 'o') valid = false; } if(!valid) 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(cnt, ans); } } cout << ans << endl; return 0; }