結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-02-09 21:30:21 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 92 ms / 5,000 ms |
| コード長 | 245 bytes |
| コンパイル時間 | 392 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 09:05:47 |
| 合計ジャッジ時間 | 1,731 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
N = int(raw_input())
W = map(int,raw_input().split())
sw = sum(W)
dp = [0]*(sw+1)
for w in W:
for i in range(sw+1-w)[::-1]:
if dp[i]:
dp[i+w] = 1
dp[w] = 1
print "possible" if sw%2 == 0 and dp[sw/2] else "impossible"