結果
| 問題 | No.4 おもりと天秤 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-12-24 20:17:45 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 508 bytes | 
| コンパイル時間 | 97 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-09-18 22:59:10 | 
| 合計ジャッジ時間 | 3,762 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 WA * 21 | 
ソースコード
def main():
    n = input()
    w = list(sorted(map(int, input().split())))
    s = sum(w)
    if s % 2 != 0:
        print("impossible")
    else:
        l = [0 for i in range(s // 2 + 1)]
        l[0] = 1
        for x in w:
            for y in range(len(l) - 1, -1, -1):
                if l[y] != 0 and y + x < len(l):
                    print(y + x, y, x)
                    l[y + x] = 1
        
        print("possible" if l[s // 2] else "impossible")
    
if __name__ == '__main__':
    main()
            
            
            
        