結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-02 00:56:10 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 103 ms / 5,000 ms |
| コード長 | 360 bytes |
| コンパイル時間 | 127 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 6,656 KB |
| 最終ジャッジ日時 | 2024-09-22 00:54:54 |
| 合計ジャッジ時間 | 1,703 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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'