結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
hanorver
|
| 提出日時 | 2016-07-13 09:17:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 810 bytes |
| コンパイル時間 | 693 ms |
| コンパイル使用メモリ | 67,712 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 15:33:07 |
| 合計ジャッジ時間 | 1,904 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 32 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
int main() {
int d, max = 0;
std::string s, s2;
std::cin >> d >> s >> s2;
s += s2;
// 前と後ろに平日を追加する
for (int i = 0; i < 14; i++) {
s.insert(0, "x");
s += "x";
}
for (int i = 0; i < s.length() - d + 1; i++) {
// i日目から有給休暇を取る
int remain_holiday = d, j = i;
std::string day = s;
while (remain_holiday != 0) {
if (day[j] == 'x') {
day[j] = 'o';
remain_holiday--;
}
j++;
}
//std::cout << day << std::endl;
int holiday = 0;
for (int j = 0; j < s.length() - i + 1; j++) {
if(day[j] == 'o'){
holiday++;
} else {
max = std::max(max, holiday);
holiday = 0;
}
}
max = std::max(max, holiday);
}
std::cout << max << std::endl;
return 0;
}
hanorver