結果

問題 No.4 おもりと天秤
ユーザー cleantted
提出日時 2016-09-11 14:55:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 335 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 21,376 KB
最終ジャッジ日時 2024-11-17 03:26:16
合計ジャッジ時間 55,394 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
V = list(map(int, input().split()))

if sum(V) % 2 == 1: print("impossible")
else:
    def sol(i, u):
        if i == N and u != 0: return 0
        if i == N and u == 0: return 1
        return max(sol(i + 1, u), sol(i + 1, u - V[i]))

    res = "possible" if sol(0, sum(V) // 2) == 1 else "impossible"
    print(res)
0