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