結果
| 問題 | No.4 おもりと天秤 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-21 15:56:43 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 138 ms / 5,000 ms |
| コード長 | 411 bytes |
| 記録 | |
| コンパイル時間 | 338 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-03-13 02:48:32 |
| 合計ジャッジ時間 | 3,709 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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")