結果

問題 No.4 おもりと天秤
ユーザー irisAshirisAsh
提出日時 2017-08-15 00:21:13
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 45,440 KB
最終ジャッジ日時 2024-04-21 01:56:10
合計ジャッジ時間 9,783 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 73 ms
39,552 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

let i = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')[1].split(' ').map((e) => parseInt(e))
let t = i.reduce((p,c) => p + c)
if (t % 2 == 1) console.log('impossible')
else {
  let r = []
  let h = t / 2
  let f = false
  for (let x of i) {
    let c = r.concat()
    c.push(x)
    r = r.map((e) => e+x)
    r = r.filter((e) => e <= h)
    r = r.concat(c)
    console.log(r)
    if (r.indexOf(h) > -1) {
      f = true
      break
    }
  }
  console.log(f ? 'possible' : 'impossible')
}
0