結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-15 00:21:13 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 501 bytes |
| コンパイル時間 | 63 ms |
| コンパイル使用メモリ | 5,248 KB |
| 実行使用メモリ | 45,312 KB |
| 最終ジャッジ日時 | 2024-10-13 00:23:48 |
| 合計ジャッジ時間 | 7,106 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 4 TLE * 1 -- * 17 |
ソースコード
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')
}