結果

問題 No.4 おもりと天秤
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-13 10:48:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 365 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 75,932 KB
最終ジャッジ日時 2023-08-20 12:16:22
合計ジャッジ時間 3,064 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
75,588 KB
testcase_01 AC 68 ms
75,640 KB
testcase_02 AC 70 ms
75,672 KB
testcase_03 AC 71 ms
75,656 KB
testcase_04 AC 72 ms
75,656 KB
testcase_05 AC 84 ms
75,864 KB
testcase_06 AC 69 ms
75,684 KB
testcase_07 AC 85 ms
75,868 KB
testcase_08 AC 82 ms
75,672 KB
testcase_09 AC 81 ms
75,932 KB
testcase_10 AC 87 ms
75,892 KB
testcase_11 AC 69 ms
75,604 KB
testcase_12 AC 69 ms
75,828 KB
testcase_13 AC 71 ms
75,604 KB
testcase_14 AC 67 ms
75,664 KB
testcase_15 AC 68 ms
75,580 KB
testcase_16 AC 69 ms
75,848 KB
testcase_17 AC 68 ms
75,840 KB
testcase_18 AC 79 ms
75,748 KB
testcase_19 AC 79 ms
75,792 KB
testcase_20 AC 81 ms
75,820 KB
testcase_21 AC 81 ms
75,716 KB
testcase_22 AC 79 ms
75,812 KB
権限があれば一括ダウンロードができます

ソースコード

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