結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
38,528 KB
testcase_01 AC 62 ms
42,624 KB
testcase_02 AC 59 ms
38,912 KB
testcase_03 AC 59 ms
38,656 KB
testcase_04 AC 58 ms
38,528 KB
testcase_05 AC 59 ms
38,912 KB
testcase_06 AC 58 ms
38,656 KB
testcase_07 AC 61 ms
38,912 KB
testcase_08 AC 66 ms
38,656 KB
testcase_09 AC 59 ms
38,912 KB
testcase_10 AC 59 ms
38,656 KB
testcase_11 AC 58 ms
38,912 KB
testcase_12 AC 59 ms
38,656 KB
testcase_13 AC 58 ms
38,528 KB
testcase_14 AC 58 ms
38,656 KB
testcase_15 AC 57 ms
38,784 KB
testcase_16 AC 60 ms
38,912 KB
testcase_17 AC 58 ms
38,912 KB
testcase_18 AC 61 ms
38,912 KB
testcase_19 AC 59 ms
38,528 KB
testcase_20 AC 60 ms
38,656 KB
testcase_21 AC 59 ms
38,784 KB
testcase_22 AC 59 ms
38,656 KB
testcase_23 AC 57 ms
38,528 KB
testcase_24 AC 56 ms
38,912 KB
testcase_25 AC 59 ms
38,784 KB
testcase_26 AC 57 ms
38,912 KB
testcase_27 AC 59 ms
38,656 KB
testcase_28 AC 59 ms
38,912 KB
testcase_29 AC 59 ms
38,912 KB
testcase_30 AC 57 ms
38,784 KB
testcase_31 AC 57 ms
38,912 KB
testcase_32 AC 61 ms
38,656 KB
testcase_33 AC 59 ms
38,656 KB
testcase_34 AC 60 ms
38,912 KB
testcase_35 WA -
testcase_36 AC 59 ms
38,528 KB
testcase_37 AC 60 ms
38,656 KB
testcase_38 AC 58 ms
38,912 KB
testcase_39 AC 57 ms
38,528 KB
testcase_40 WA -
testcase_41 AC 59 ms
38,656 KB
testcase_42 AC 57 ms
38,912 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 59 ms
38,784 KB
testcase_46 AC 60 ms
38,656 KB
testcase_47 AC 61 ms
38,656 KB
testcase_48 AC 57 ms
38,656 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; 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