結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2023-09-29 09:33:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 69 ms / 5,000 ms |
コード長 | 251 bytes |
コンパイル時間 | 186 ms |
コンパイル使用メモリ | 82,084 KB |
実行使用メモリ | 61,184 KB |
最終ジャッジ日時 | 2024-07-22 04:08:43 |
合計ジャッジ時間 | 2,566 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
N = int(input()) W = list(map(int, input().split())) dp = [False] * (1 << 15) dp[0] = True for i in range(N): for j in range(1 << 14, -1, -1): dp[j] |= dp[j - W[i]] print('possible' if sum(W) & 1 == 0 and dp[sum(W) // 2] else 'impossible')