結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー 0w10w1
提出日時 2018-05-08 12:57:39
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 927 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 5,504 KB
実行使用メモリ 43,392 KB
最終ジャッジ日時 2024-04-21 02:07:06
合計ジャッジ時間 1,895 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
38,656 KB
testcase_01 AC 64 ms
38,912 KB
testcase_02 AC 73 ms
38,656 KB
testcase_03 AC 59 ms
38,912 KB
testcase_04 AC 60 ms
38,656 KB
testcase_05 AC 67 ms
38,912 KB
testcase_06 AC 62 ms
38,656 KB
testcase_07 AC 60 ms
38,912 KB
testcase_08 AC 66 ms
38,784 KB
testcase_09 AC 65 ms
38,528 KB
testcase_10 AC 67 ms
38,912 KB
testcase_11 AC 66 ms
38,784 KB
testcase_12 AC 63 ms
39,040 KB
testcase_13 AC 69 ms
43,264 KB
testcase_14 AC 71 ms
42,880 KB
testcase_15 AC 74 ms
43,392 KB
testcase_16 AC 59 ms
38,912 KB
testcase_17 AC 72 ms
43,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {

  const MAXW = 1280;

  input = input.split('\n')

  let N, xLB, xRB;
  [N, xLB, xRB] = input[0].split(' ').map((e) => e - 0);

  let XL = new Array(N);
  let YU = new Array(N);
  let XR = new Array(N);
  let YD = new Array(N);
  for (let i = 0; i < N; ++i) {
    [XL[i], YU[i], XR[i], YD[i]] = input[1 + i].split(' ').map((e) => e - 0);
  }

  let ans = new Array(N).fill(0);
  let hit_y = new Array(MAXW + 1).fill(-1);
  for (let i = xLB; i <= xRB; ++i) {
    let k = -1;
    for (var j = 0; j < N; ++j) {
      if (i < XL[j] || XR[j] < i) continue;
      if (YD[j] > hit_y[i]) {
        hit_y[i] = YD[j];
        k = j;
      }
    }
    if (k != -1) {
      ans[k] = 1;
    }
  }

  for (let i = 0; i < N; ++i) {
    console.log('%d', ans[i]);
  }

}

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

function debug() {
  let input = document.getElementById('input').value;
  Main(input);
}
0