結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-08-16 21:40:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 853 bytes |
| コンパイル時間 | 638 ms |
| コンパイル使用メモリ | 66,868 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-11-07 18:23:22 |
| 合計ジャッジ時間 | 3,113 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | WA * 1 TLE * 1 -- * 44 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int d, ans;
void solve(int cnt, vector<bool> tf) {
cnt++;
int cnt2=0;
for (int j = 0; j < 14; j++) {
if (!tf[j]) { //cout << cnt << endl;
//cout << j << endl;
vector<bool>tf2;
tf2 = tf;
tf2[j] = true;
if (cnt == d) {
for (int k = 0; k < 14; k++) {
if (tf2[k]) cnt2++;
else {
//cout << cnt2 << endl;
ans = max(cnt2, ans);
cnt2 = 0;
}
}
ans = max(cnt2, ans);
//cout << ans << endl;
cnt2 = 0;
}
else {
solve(cnt, tf2);
}
}
}
}
int main()
{
int cnt = 0;
vector<bool> tf;
tf.resize(14);
cin >> d;
for (int i = 0; i < 14; i++) {
char c;
cin >> c;
if (c == 'o') tf[i] = true;
else tf[i] = false;
}
solve(0, tf);
cout << ans << endl;
return 0;
}
kurenai3110