結果
問題 | No.4 おもりと天秤 |
ユーザー | irisAsh |
提出日時 | 2017-08-15 00:21:53 |
言語 | JavaScript (node v20.8.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 482 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 5,460 KB |
実行使用メモリ | 845,068 KB |
最終ジャッジ日時 | 2023-08-03 02:18:42 |
合計ジャッジ時間 | 4,350 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
42,228 KB |
testcase_01 | AC | 78 ms
42,364 KB |
testcase_02 | AC | 86 ms
45,056 KB |
testcase_03 | AC | 74 ms
42,248 KB |
testcase_04 | AC | 77 ms
42,504 KB |
testcase_05 | MLE | - |
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 | -- | - |
ソースコード
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) if (r.indexOf(h) > -1) { f = true break } } console.log(f ? 'possible' : 'impossible') }