結果
問題 | No.4 おもりと天秤 |
ユーザー |
![]() |
提出日時 | 2016-03-09 21:49:38 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 383 bytes |
コンパイル時間 | 41 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 17:06:01 |
合計ジャッジ時間 | 1,475 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 3 |
ソースコード
# -*- coding: utf-8 -*-#inputN = input()W = map(int, raw_input().split())if sum(W) % 2 == 1:print "impossible"exit()sumhalf = sum(W) / 2# dynamic programmingDP = [0] * (sumhalf + 100)DP[0] = 1for w in W:for i in range(sumhalf):if DP[i] == 1:DP[i + w] = 1# outputif DP[sumhalf] == 1:print "possible"else:print "impossible"