結果

問題 No.4 おもりと天秤
ユーザー CsTarepanda
提出日時 2017-05-04 00:09:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 388 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 17,568 KB
最終ジャッジ日時 2024-09-14 07:11:35
合計ジャッジ時間 7,466 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 TLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
n = int(input())
a = list(map(int, input().split()))
ans = sum(a)
if ans & 1:
    print("impossible")
    sys.exit()
ans >>= 1

dp = [{} for x in range(n)]

def solve(i, w):
    if w < 0 or i >= n:
        return None
    if w == 0:
        print("possible")
        sys.exit()
        return w
    solve(i + 1, w - a[i])
    solve(i + 1, w)

solve(0, ans)
print("impossible")
0