結果

問題 No.4 おもりと天秤
ユーザー lllllll88938494
提出日時 2022-09-13 10:48:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 5,000 ms
コード長 365 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 67,456 KB
最終ジャッジ日時 2024-11-30 13:57:39
合計ジャッジ時間 2,338 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
sum=sum(a)

dp=[[False]*10010 for i in range(n+1)]
dp[0][0] = True

for i in range(n):
    for j in range(10010):
        if dp[i][j] == False:
            continue
        dp[i+1][j] = True
        dp[i+1][j+a[i]] = True

if dp[-1][sum//2] == True and sum%2 == 0:
    print('possible')
else:
    print('impossible')
0