結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2015-05-09 00:41:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 720 bytes |
コンパイル時間 | 557 ms |
コンパイル使用メモリ | 65,408 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-13 12:05:31 |
合計ジャッジ時間 | 1,758 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 34 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<vector> using namespace std; int cnt(string s){ int count = 0; int max_day = 0; for (int i = 0; i < 14; i++){ if (s[i] == 'o'){ count++; } else{ max_day = max(max_day, count); count = 0; } } max_day = max(max_day, count); return max_day; } int main() { string s, s2,t; int n; cin >> n; cin >> s >> s2; s += s2; vector<int>p; for (int i = 0; i < s.size(); i++){ if (s[i] == 'x'){ p.push_back(i); } } int max_v = 0; for (int i = 0; i < p.size(); i++){ int count = 0; t = s; for (int i2 = i; i2 < p.size()&&count<n; i2++,count++){ t[p[i2]] = 'o'; } max_v = max(max_v, cnt(t)); } cout << max_v << endl; }