結果

問題 No.4 おもりと天秤
ユーザー mlihua09
提出日時 2020-08-23 11:14:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 55 ms / 5,000 ms
コード長 348 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 82,128 KB
実行使用メモリ 68,608 KB
最終ジャッジ日時 2024-10-15 18:04:07
合計ジャッジ時間 1,952 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #




N = int(input())

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

w = sum(W)


if w % 2 == 1:
    
    print('impossible')
    
    exit()
    
dp = [1] + [0] * w


for i in W:
    
    
    for j in range(w, i - 1, -1):
        
        dp[j] += dp[j - i]
        
if dp[w // 2]:
    
    print('possible')


else:
    
    print('impossible')
    
    
0