結果
問題 | No.1701 half price |
ユーザー | vwxyz |
提出日時 | 2021-10-08 21:57:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 904 bytes |
コンパイル時間 | 302 ms |
コンパイル使用メモリ | 87,008 KB |
実行使用メモリ | 95,296 KB |
最終ジャッジ日時 | 2023-09-30 10:00:19 |
合計ジャッジ時間 | 8,158 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 277 ms
91,376 KB |
testcase_01 | AC | 273 ms
91,344 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 273 ms
91,364 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 280 ms
91,276 KB |
testcase_10 | AC | 279 ms
91,352 KB |
testcase_11 | WA | - |
testcase_12 | AC | 277 ms
91,468 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 279 ms
91,472 KB |
testcase_16 | AC | 282 ms
91,280 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 275 ms
91,408 KB |
testcase_21 | AC | 299 ms
94,828 KB |
ソースコード
import bisect import copy import decimal import fractions import functools import heapq import itertools import math import random import sys from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines N,W=map(int,readline().split()) A=list(map(int,readline().split())) ans=0 for bit in range(1<<N): lst=[A[i] for i in range(N) if bit>>i&1] S=sum(lst) if S==W: ans+=1 x=(S-W)*2 ans+=lst.count(x) print(ans)