結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2016-09-13 14:36:02 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 219 ms / 5,000 ms |
コード長 | 386 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-26 09:59:58 |
合計ジャッジ時間 | 3,384 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
n = int(input()) w = list(map(int, input().split())) weightSum = sum(w) if weightSum % 2 == 1: print("impossible") else: weightPossible = [0]*10001 weightPossible[0] = 1 for i in range(n): for j in reversed(range(10001)): if weightPossible[j - w[i]] == 1: weightPossible[j] = 1 if weightPossible[weightSum // 2] == 1: print("possible") else: print("impossible")