結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
|
提出日時 | 2018-12-25 22:22:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 686 bytes |
コンパイル時間 | 541 ms |
コンパイル使用メモリ | 67,200 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-01 13:33:16 |
合計ジャッジ時間 | 1,933 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 WA * 14 |
ソースコード
#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int D, ans = 0, sum; string C = "xxxxxxxxxxxxxx", tmp; cin >> D; for (int i = 0; i < 2; ++i) { cin >> tmp; C += tmp; } C += "xxxxxxxxxxxxxx"; if (D == 0) { sum = 0; for (size_t i = 0; i < 42; ++i) { if (tmp[i] == 'o') ++sum; else { ans = max(ans, sum); sum = 0; } } } else { for (int i = 0; i < 43 - D; ++i) { sum = 0; tmp = C; tmp.replace(i, D, D, 'o'); for (size_t j = 0; j < 42; ++j) { if (tmp[j] == 'o') ++sum; else { ans = max(ans, sum); sum = 0; } } } } cout << ans; }