結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2017-12-21 15:56:43 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 103 ms / 5,000 ms |
コード長 | 411 bytes |
コンパイル時間 | 313 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-26 10:25:57 |
合計ジャッジ時間 | 2,264 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
a=int(input()) s=list(map(int,input().split())) half_sum=sum(s)/2 if sum(s)%2==1: print("impossible") else: half_sum=int(half_sum) r_list=[False]*(half_sum+1) r_list[0]=True for i in s: for j in range(half_sum,-1,-1): if r_list[j] and j+i<=half_sum: r_list[j+i]=True if r_list[half_sum]: print("possible") else: print("impossible")