結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-11 14:58:25 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 495 bytes |
| コンパイル時間 | 204 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-10-07 07:52:15 |
| 合計ジャッジ時間 | 2,334 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 WA * 1 |
ソースコード
N=int(input())
W=list(map(int,input().split()))
w=int(sum(W)/2)
def ans():
if sum(W)%2!=0:
return 0
a=[[0]*(w+1)]*(len(W)+1)
a[0][0]=1
for i in range(1,len(W)):
for j in range(w+1):
if j>=W[i-1]:
if a[i-1][j-W[i-1]]:
a[i][j]=1
if a[i-1][j]==1:
a[i][j]=1
return a[len(W)][w]
def c(n):
if n==1:
return 'possible'
if n==0:
return 'impossible'
print(c(ans()))