結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
YamaKasa
|
| 提出日時 | 2018-10-16 00:29:28 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 237 ms / 5,000 ms |
| コード長 | 409 bytes |
| コンパイル時間 | 271 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 18,560 KB |
| 最終ジャッジ日時 | 2024-10-12 18:38:20 |
| 合計ジャッジ時間 | 3,403 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
N = int(input())
W = list(map(int,input().split()))
sum = sum(W)
if sum % 2 != 0:
print("impossible")
exit()
dp = [[0] * 10001 for i in range(N + 1)]
dp[0][0] = 1
idx = 0
for w in W:
for i in range(10000):
if dp[idx][i] == 1:
dp[idx + 1][i + w] = 1
dp[idx + 1][i] = 1
idx += 1
if dp[N][int(sum / 2)] == 1:
print("possible")
else:
print("impossible")
YamaKasa