結果
| 問題 | No.4 おもりと天秤 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-02 00:56:10 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 5,000 ms |
| + 414µs | |
| コード長 | 360 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 81,572 KB |
| 実行使用メモリ | 82,560 KB |
| 最終ジャッジ日時 | 2026-07-18 18:25:55 |
| 合計ジャッジ時間 | 2,973 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
n = int(input()) arr = map(int,raw_input().split()) accumlate = sum(arr) if accumlate %2 == 1: print 'impossible' quit() dp = [0 for i in range(accumlate/2 + 1)] dp[0] = 1 for i in arr: tmp = dp[::1] for j in range(accumlate/2+1): if j - i > -1 and dp[j-i] == 1: tmp[j] = 1 dp = tmp[::1] print 'possible' if dp[accumlate/2] else 'impossible'