結果
問題 |
No.617 Nafmo、買い出しに行く
|
ユーザー |
|
提出日時 | 2017-12-17 18:27:42 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 488 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 81,972 KB |
実行使用メモリ | 131,968 KB |
最終ジャッジ日時 | 2024-12-15 22:42:37 |
合計ジャッジ時間 | 31,921 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 WA * 2 TLE * 10 |
ソースコード
#!/usr/bin/env python import itertools indat = [int(x) for x in input().split()] weights = set() for i in range(indat[0]): weights.add(int(input())) ans = 0 for perm in itertools.permutations(weights): tmp = 0 for l in perm: if tmp + l > indat[1]: break elif tmp + l <= indat[1]: tmp += l continue if tmp == indat[1]: ans = tmp break elif tmp > ans: ans = tmp continue print(ans)