結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー d2verb
提出日時 2015-05-11 00:21:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,133 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 84,924 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-13 12:46:53
合計ジャッジ時間 1,814 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <complex>

using namespace std;

#define INF (INT_MAX/3)
#define PI (2*acos(0.0))
#define EPS (1e-8)

typedef long long ll;
typedef unsigned long long ull;

int check(const string& bk){
  int cnt = 0, ret = 0;
  for(int i = 0; i < 14; i++){
    if(bk[i] == 'o') cnt++;
    else cnt = 0;
    ret = max(ret, cnt);
  }
  return ret;
}

int main(){
  ios_base::sync_with_stdio(0);
  int D;
  string d, t;
  cin >> D;
  cin >> d >> t;
  d += t;

  int m = 0;
  for(int i = 0; i < 14; i++){
    string bk = d;
    
    bool ok = true;
    for(int j = i; j < i + D; j++){
      if(j == 14 || bk[j] == 'o') {ok = false; break;}
    }
    if(!ok) continue;

    for(int j = i; j < i + D; j++){
      if(j == 14) break;
      if(bk[j] == 'x') bk[j] = 'o';
    }
    m = max(m, check(bk));
  }
  cout << m << endl;
  return 0;
}
0