結果
問題 |
No.1701 half price
|
ユーザー |
![]() |
提出日時 | 2021-10-10 10:43:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 589 ms / 3,000 ms |
コード長 | 794 bytes |
コンパイル時間 | 248 ms |
コンパイル使用メモリ | 82,036 KB |
実行使用メモリ | 76,808 KB |
最終ジャッジ日時 | 2024-09-14 05:00:23 |
合計ジャッジ時間 | 4,141 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
import sys input = sys.stdin.readline #input = sys.stdin.buffer.readline import itertools def main(): N,W = map(int,input().split()) A = list(map(int,input().split())) sgn = [0,1,2] ans = set([]) Flag = True for L in itertools.product(sgn,repeat=N): if Flag: #最初は空集合 Flag = False continue #print(L) temp = 0 used = [] for i,x in enumerate(L): if x == 1: temp += A[i] used.append(i) if x == 2: temp += A[i]//2 used.append(i) if temp == W: used.sort() tused = tuple(used) ans.add(tused) #print(ans) print(len(ans)) if __name__ == '__main__': main()