結果
| 問題 | No.4 おもりと天秤 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-13 13:09:02 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 753 ms / 5,000 ms |
| + 592µs | |
| コード長 | 472 bytes |
| 記録 | |
| コンパイル時間 | 282 ms |
| コンパイル使用メモリ | 21,536 KB |
| 実行使用メモリ | 15,868 KB |
| 最終ジャッジ日時 | 2026-07-30 13:04:28 |
| 合計ジャッジ時間 | 7,630 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
N = int(input())
W = list(map(int , input().split()))
total = 0
for i in W:
total += i
W.sort()
b = False
if total % 2 == 0:
total //= 2
sum = [0 , W[0]]
for i in range(1 , N):
sublist = []
for s in sum:
s += W[i]
if s == total:
b = True
break
elif not(s in sum) and s < total:
sublist.append(s)
if b:
break
sum += sublist
sum.sort()
if b:
print("possible")
else:
print("impossible")