結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
rocoder
|
| 提出日時 | 2017-08-13 17:21:21 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 755 bytes |
| コンパイル時間 | 141 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 453,888 KB |
| 最終ジャッジ日時 | 2024-10-13 09:10:04 |
| 合計ジャッジ時間 | 6,843 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 2 TLE * 1 -- * 20 |
ソースコード
# your code goes here
#scale
N=int(input())
print(N)
W=[int(i) for i in input().split()]
print(W)
S=0
for i in range(N):
S+=W[i]
if S%2==1:
p="impossible"
else:
W.sort()
S//=2
S-=W[-1]
Nd=0
if S==0:
Nd=1
else:
W.pop(-1)
T=[0]
U=[0]
i=0
while Nd==0 and i <N:
print(T)
T=U
j=0
print(T)
while Nd==0 and j <len(T):
v=T[j]+W[i]
if v==S:
Nd=1
else:
U.append(v)
j+=1
set(U)
# print(j)
i+=1
if Nd==1:
p="possible"
else:
p="impossible"
print(p)
rocoder