結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
goto_isyuku
|
| 提出日時 | 2017-05-28 23:04:10 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 629 bytes |
| コンパイル時間 | 99 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-09-21 15:47:02 |
| 合計ジャッジ時間 | 1,605 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 RE * 19 |
ソースコード
n = input()
wl = [int(x) for x in input().split()]
if sum(wl) % 2 == 1:
print("impossible")
else:
obj_sum = sum(wl) // 2
x = True
tmp = [[[], 0]]
cnt = 0
while x and cnt < len(wl) - 1:
new_tmp = []
for t in tmp:
for i in range(len(wl)):
if i not in t[0]:
new_tmp.append([t[0].append(i), t[1] + wl[i]])
for i in new_tmp:
if i[1] == obj_sum:
x = False
break
cnt += 1
tmp = new_tmp
if x:
print("impossible")
else:
print("possible")
goto_isyuku