結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2016-08-16 22:11:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 643 bytes |
コンパイル時間 | 740 ms |
コンパイル使用メモリ | 66,636 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:56:32 |
合計ジャッジ時間 | 2,247 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int d,ans; int main() { int cnt = 0; vector<bool> tf; tf.resize(42); cin >> d; for (int i = 14; i < 28; i++) { char c; cin >> c; if (c == 'o') tf[i] = true; } for (int i = 0; i < 29; i++) { if (!tf[i]) { vector<bool>tf2; tf2 = tf; for (int j = 0; j < d; j++) { if(!tf2[i+j]) tf2[i+j] = true; else break; } cnt = 0; for (int k = 0; k < 42; k++) { if (tf2[k]) cnt++; else { ans = max(ans, cnt); cnt=0; } } ans = max(ans, cnt); } } cout << ans << endl; return 0; }