結果
| 問題 | No.4 おもりと天秤 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-06-15 23:35:02 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 375 bytes | 
| コンパイル時間 | 517 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-06-15 23:35:05 | 
| 合計ジャッジ時間 | 3,155 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 WA * 13 | 
ソースコード
N = int(input())
W = list(map(int, input().split()))
total = sum(W)
if total % 2:
    print('impossible')
else:
    half = total // 2
    dp = [0] * (half + 1)
    dp[0] = 1
    for w in W:
        for i in range(half, w - 1, -1):
            if dp[i - w]:
                dp[i] = 1
        if dp[half]:
            print('possible')
            break
    print('impossible')
            
            
            
        