結果
問題 | No.4 おもりと天秤 |
ユーザー |
![]() |
提出日時 | 2022-02-17 10:42:20 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 172 ms / 5,000 ms |
コード長 | 257 bytes |
コンパイル時間 | 147 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-06-29 07:31:47 |
合計ジャッジ時間 | 2,295 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
N = int(input())W = list(map(int, input().split()))S = sum(W)dp = [ False ] * (S + 1)dp[0] = Truefor x in W:for i in range(S, x - 1, -1):if dp[i - x]:dp[i] = Trueif S % 2 == 1 or not dp[S // 2]:print("impossible")else:print("possible")