結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2015-05-20 13:51:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,010 bytes |
コンパイル時間 | 795 ms |
コンパイル使用メモリ | 83,764 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 12:48:38 |
合計ジャッジ時間 | 1,965 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 22 |
ソースコード
#include <algorithm> #include <vector> #include <cfloat> #include <string> #include <cmath> #include <set> #include <cstdlib> #include <map> #include <ctime> #include <iomanip> #include <functional> #include <deque> #include <iostream> #include <cstring> #include <queue> #include <cstdio> #include <stack> #include <climits> #include <sys/time.h> #include <cctype> using namespace std; typedef long long ll; int main() { int d; cin >> d; string s, t; cin >> s; cin >> t; s += t; t = s; int ans = -1, cnt = 0; for (int i = 0; i < s.size()-1; i++) { if (s[i+1] != 'o') { ans = i+1+d; break; } } if (ans == -1) { ans = s.size()+d; } for (int p = 0; p < s.size()-d+1; p++) { for (int i = 0; i < d; i++) { s[p+i] = 'o'; } cnt = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == 'o') { cnt++; }else { ans = max(ans, cnt); cnt = 0; } } ans = max(ans, cnt); s = t; } std::cout << ans << std::endl; }