結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
mediocreRail
|
| 提出日時 | 2023-08-15 08:31:28 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 832 bytes |
| コンパイル時間 | 227 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-11-23 14:22:06 |
| 合計ジャッジ時間 | 4,171 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 6 |
ソースコード
import bisect,collections,itertools,math,functools,heapq
import sys
#sys.setrecursionlimit(10**6)
def I(): return int(sys.stdin.readline().rstrip())
def IN(): return int(input())
def LIN(): return list(map(int, input().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LF(): return list(map(float,sys.stdin.readline().rstrip().split()))
def SI(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
"""
方針
dp
"""
N=I()
W=LI()
W.sort()
sa = sum(W)
if sa%2!=0:
print('impossible')
exit()
dp = [False]*(11000)
dp[0] = True
for i in range(N):
w = W[i]
np = dp
for j in range(10050):
if dp[j]:
np[j] = True
np[w+j] = True
dp = np
if dp[N//2]:
print('possible')
else:
print('impossible')
mediocreRail