結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー k
提出日時 2020-07-09 23:37:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,026 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 199,208 KB
最終ジャッジ日時 2025-01-11 17:17:02
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);

int calc(const vector<bool> &b) {
  int ret = 0;
  for (int i = 0; i < b.size(); i++) {
    if (!b[i]) continue;
    int j = i;
    while (j < b.size() && b[j]) {
      ++j;
    }
    ret = max(ret, j - i);
    i = j-1;
  }
  return ret;
}


int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int d;
  cin >> d;
  vector<bool> b(14 * 3);

  string s1, s2;
  cin >> s1 >> s2;
  string s = s1 + s2;

  REP (i, 14) {
    if (s[i] == 'o')
      b[14 + i] = true;
  }

  int ret = calc(b);

  for (int i = 0; i + d - 1 < 14 * 3; i++) {
    bool ck = true;
    for (int j = i; j < i + d; j++) {
      ck &= !b[j];
    }
    if (ck) {
      vector<bool> x = b;
      for (int j = i; j < i + d; j++)
        x[j] = true;
      ret = max(ret, calc(x));
    }
  }

  cout << ret << endl;
  
  return 0;
}
0