結果
| 問題 | No.4 おもりと天秤 |
| コンテスト | |
| ユーザー |
CsTarepanda
|
| 提出日時 | 2017-05-04 00:12:54 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 426 bytes |
| 記録 | |
| コンパイル時間 | 407 ms |
| コンパイル使用メモリ | 20,572 KB |
| 実行使用メモリ | 15,488 KB |
| 最終ジャッジ日時 | 2026-04-04 11:06:39 |
| 合計ジャッジ時間 | 3,692 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 10 |
ソースコード
import sys
n = int(input())
a = list(map(int, input().split()))
ans = sum(a)
if ans & 1:
print("impossible")
sys.exit()
ans >>= 1
dp = {}
def solve(i, w):
if dp.get(w):
return None
dp[w] = True
if w < 0 or i >= n:
return None
if w == 0:
print("possible")
sys.exit()
return None
solve(i + 1, w - a[i])
solve(i + 1, w)
solve(0, ans)
print("impossible")
CsTarepanda