結果
| 問題 | No.4 おもりと天秤 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-20 10:44:48 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 131 ms / 5,000 ms |
| コード長 | 392 bytes |
| 記録 | |
| コンパイル時間 | 570 ms |
| コンパイル使用メモリ | 20,960 KB |
| 実行使用メモリ | 15,484 KB |
| 最終ジャッジ日時 | 2026-06-03 11:34:41 |
| 合計ジャッジ時間 | 3,854 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
def main():
""" main """
N = int(input())
WS = list(map(int, input().split()))
total = sum(WS)
if total & 1 == 1:
print('impossible')
return
half = total >> 1
dp = set([0])
for i in WS:
dp |= set([i+j for j in dp])
if half in dp:
print('possible')
break
else:
print('impossible')
main()