結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-13 13:07:09 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 502 bytes |
| コンパイル時間 | 216 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-06-26 12:00:07 |
| 合計ジャッジ時間 | 7,736 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 RE * 2 |
ソースコード
N = int(input())
W = list(map(int , input().split()))
total = 0
for i in W:
total += i
W.sort()
if total % 2 == 1:
print("impossible")
else:
total //= 2
sum = [0 , W[0]]
b = False
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")