結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-27 02:18:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 382 bytes |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 81,972 KB |
| 実行使用メモリ | 91,940 KB |
| 最終ジャッジ日時 | 2024-09-30 14:29:44 |
| 合計ジャッジ時間 | 2,420 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 21 |
ソースコード
n=int(input())
w=list(map(int,input().split()))
s=sum(w)
if s%2!=0:
print("impossible")
exit()
dp=[[0]*s for i in range(n+1)]
dp[0][0]=1
for i in range(n):
for j in range(s):
if dp[i][j]==1:
dp[i+1][j]=1
if j+w[i]<s:
dp[i+1][j+w[i]]=1
print(dp)
if dp[n-1][int(s/2)]==1:
print("possible")
else:
print("impossible")