結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2015-12-24 20:10:50 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 441 bytes |
コンパイル時間 | 183 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-09-18 22:59:06 |
合計ジャッジ時間 | 2,082 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 3 |
ソースコード
def main(): n = input() w = list(map(int, input().split())) s = sum(w) if s % 2 != 0: print("impossible") else: l = [0 for i in range(s // 2 + 1)] l[0] = 1 for x in w: for y in range(len(l)): if l[y] != 0 and y + x < len(l): l[y + x] = 1 print("possible" if l[s // 2] else "impossible") if __name__ == '__main__': main()