結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー jp_stejp_ste
提出日時 2019-08-05 05:33:14
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 1,006 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 7,068 KB
実行使用メモリ 41,720 KB
最終ジャッジ日時 2024-04-21 02:49:12
合計ジャッジ時間 4,533 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
39,424 KB
testcase_01 AC 66 ms
39,296 KB
testcase_02 AC 65 ms
39,424 KB
testcase_03 AC 64 ms
39,296 KB
testcase_04 AC 67 ms
39,424 KB
testcase_05 AC 66 ms
39,296 KB
testcase_06 AC 66 ms
39,424 KB
testcase_07 AC 65 ms
39,424 KB
testcase_08 AC 65 ms
39,424 KB
testcase_09 AC 68 ms
39,296 KB
testcase_10 AC 65 ms
39,680 KB
testcase_11 AC 64 ms
39,296 KB
testcase_12 AC 64 ms
39,680 KB
testcase_13 AC 64 ms
39,680 KB
testcase_14 AC 64 ms
39,296 KB
testcase_15 AC 67 ms
39,296 KB
testcase_16 AC 65 ms
39,296 KB
testcase_17 AC 65 ms
39,424 KB
testcase_18 AC 64 ms
39,424 KB
testcase_19 AC 66 ms
39,424 KB
testcase_20 AC 64 ms
39,552 KB
testcase_21 AC 67 ms
39,424 KB
testcase_22 WA -
testcase_23 AC 64 ms
39,296 KB
testcase_24 WA -
testcase_25 AC 67 ms
39,296 KB
testcase_26 AC 64 ms
39,296 KB
testcase_27 AC 65 ms
39,424 KB
testcase_28 AC 64 ms
39,424 KB
testcase_29 AC 68 ms
39,680 KB
testcase_30 AC 65 ms
39,296 KB
testcase_31 AC 64 ms
39,424 KB
testcase_32 AC 64 ms
39,680 KB
testcase_33 AC 66 ms
39,680 KB
testcase_34 AC 63 ms
39,424 KB
testcase_35 WA -
testcase_36 AC 64 ms
39,424 KB
testcase_37 AC 65 ms
39,296 KB
testcase_38 AC 63 ms
39,424 KB
testcase_39 AC 65 ms
39,296 KB
testcase_40 WA -
testcase_41 AC 65 ms
39,424 KB
testcase_42 AC 65 ms
39,296 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 65 ms
39,424 KB
testcase_46 AC 65 ms
39,552 KB
testcase_47 WA -
testcase_48 AC 64 ms
39,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
  const data = input.split("\n");
  const d = Number(data[0]);
  const c = data[1] + data[2];
  let realD = d;
  let realC = 'x'.repeat(d) + c + 'x'.repeat(d);
  let max = 0;
  for(let j=0; j<d; j++) {
    for(let i=0; i<realC.length-realD; i++) {
      if(haveLengthX(realC, i, realD)) {
        let len = countBeforA(realC, i-1) + realD + countAfterA(realC, i+realD);
        max = Math.max(max, len);
      }
    }
    realD--;
  }
  console.log(max);
}

function haveLengthX(list, start, length) {
  for(let i=start; i<start+length; i++) {
    if(list[i] == 'o') return false;
  }
  return true;
}

function countAfterA(list, start) {
  let count = 0;
  for(let i=start; i<list.length; i++) {
    if(list[i] == 'x') return count;
    count++;
  }
  return count;
}

function countBeforA(list, start) {
  let count = 0;
  for(let i=start; i>=0; i--) {
    if(list[i] == 'x') return count;
    count++;
  }
  return count;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0