結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
iga_xx
|
| 提出日時 | 2015-11-21 18:06:50 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 5,000 ms |
| コード長 | 409 bytes |
| コンパイル時間 | 88 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-06-26 09:20:54 |
| 合計ジャッジ時間 | 1,821 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
import sys
N = int(input())
W = list(map(int,input().split()))
W2 = int(sum(W)/2)
if sum(W) % 2 == 1:
print("impossible")
sys.exit()
dp = [False] * (W2 + 1)
dp[0] = True
for i in W:
for j in range(W2, -1, -1):
if dp[j]:
if j+i == W2:
print("possible")
sys.exit()
elif j+i < W2:
dp[j+i] = True
print("impossible")
iga_xx