結果

問題 No.4 おもりと天秤
ユーザー るこーそー
提出日時 2024-09-24 15:34:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 280 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 82,008 KB
実行使用メモリ 62,220 KB
最終ジャッジ日時 2024-09-24 15:34:35
合計ジャッジ時間 2,095 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
W=list(map(int,input().split()))

sum_w=sum(W)
dp=[False]*(sum_w+1)
dp[0]=True
for i in range(n):
    for j in range(sum_w,-1,-1):
        if j-W[i]>=0:
            dp[j]|=dp[j-W[i]]
      
        
print("possible" if sum_w%2==0 and dp[sum_w//2] else "impossible")
0