結果
問題 | No.4 おもりと天秤 |
ユーザー |
![]() |
提出日時 | 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#scaleN=int(input())print(N)W=[int(i) for i in input().split()]print(W)S=0for i in range(N):S+=W[i]if S%2==1:p="impossible"else:W.sort()S//=2S-=W[-1]Nd=0if S==0:Nd=1else:W.pop(-1)T=[0]U=[0]i=0while Nd==0 and i <N:print(T)T=Uj=0print(T)while Nd==0 and j <len(T):v=T[j]+W[i]if v==S:Nd=1else:U.append(v)j+=1set(U)# print(j)i+=1if Nd==1:p="possible"else:p="impossible"print(p)