結果
問題 | No.4 おもりと天秤 |
ユーザー |
|
提出日時 | 2020-07-12 10:15:24 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 288 ms / 5,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2024-10-14 10:33:16 |
合計ジャッジ時間 | 4,659 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
num = int(input()) numbers = list(map(int, input().split())) summery = 0 for number in numbers: summery += number if summery % 2 == 0: dp = [[0 for i in range(10001)] for j in range(101)] dp[0][0] = 1 for i in range(num): for j in range(10001): if dp[i][j] == 1: dp[i + 1][j + numbers[i]] = 1 dp[i + 1][j] = 1 if dp[num][summery // 2] == 1: print("possible") else: print("impossible") else: print("impossible")