結果

問題 No.4 おもりと天秤
ユーザー トミー
提出日時 2024-03-27 02:02:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 353 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 65,664 KB
最終ジャッジ日時 2024-09-30 14:29:41
合計ジャッジ時間 2,042 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 21 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
w=list(map(int,input().split()))
s=sum(w)
if s&1==0:
    print("impossile")
    exit()
dp=[[0]*int(s/2) for i in range(n+1)]
dp[0][0]=1
for i in range(n-1):
    for j in range(int(s/2)):
        if dp[i][j]==1:
            dp[i+1][j]=1
            dp[i+1][w[i]]=1

if dp[n-1][int(s/2)]:
    print("possible")
else:
    print("impossible")
0