結果

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

ソースコード

diff #

#include <bits/stdc++.h>

int main() {

  std::string str1, str2, str3;
  char str[32];
  int ans = 0;
  int d;

  std::cin >> d;
  std::cin >> str1 >> str2;
  str3 += "xxxxxxxxxxxxxx";
  str3 += str1;
  str3 += str2;


  for(int k = 0; k < 28; ++k) {
    strcpy(str, str3.c_str());
    for(int i = k; i < k+d; ++i) {
      if( i >= 28 ) { break; }
      if( str[i] == 'x' ) {
	str[i] = 'o';
      }
      else {
	goto label_1;
      }
    }
    for(int i = 14; i < 28; ++i) {
      if( str[i] == 'o' ) {
	for(int j = i+1; j <= 28; ++j) {
	  if( str[i] != str[j] ) {
	    ans = std::max(ans, j-i);
	    i = j-1;
	    break;
	  }
	}
      }
    }
  label_1:
    ans = ans;

  }

  std::cout << ans << std::endl;

  return 0;
}
0