結果
| 問題 | No.4 おもりと天秤 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-11 14:58:25 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 495 bytes |
| 記録 | |
| コンパイル時間 | 631 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-04-24 00:39:51 |
| 合計ジャッジ時間 | 6,538 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()))