結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-05 10:26:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 5,000 ms |
| コード長 | 272 bytes |
| コンパイル時間 | 319 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 58,880 KB |
| 最終ジャッジ日時 | 2024-12-30 12:57:16 |
| 合計ジャッジ時間 | 2,552 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
n = int(input())
W = list(map(int,input().split()))
M = 10**4
dp = [0]*(M+5)
dp[0] = 1
for w in W:
for i in range(M)[::-1]:
if dp[i] and i+w <= M:
dp[i+w] = 1
s = sum(W)
if s%2 == 0 and dp[s//2]:
print("possible")
else:
print("impossible")