結果

問題 No.1701 half price
ユーザー yassu0320yassu0320
提出日時 2021-11-05 00:10:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 957 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 82,384 KB
最終ジャッジ日時 2024-04-23 06:55:34
合計ジャッジ時間 4,870 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
79,872 KB
testcase_01 AC 89 ms
80,824 KB
testcase_02 AC 134 ms
80,964 KB
testcase_03 AC 84 ms
80,692 KB
testcase_04 AC 133 ms
81,088 KB
testcase_05 AC 92 ms
80,940 KB
testcase_06 AC 526 ms
81,384 KB
testcase_07 AC 544 ms
81,416 KB
testcase_08 WA -
testcase_09 AC 88 ms
80,852 KB
testcase_10 AC 83 ms
80,396 KB
testcase_11 AC 86 ms
80,760 KB
testcase_12 AC 93 ms
81,068 KB
testcase_13 AC 89 ms
80,664 KB
testcase_14 AC 88 ms
80,908 KB
testcase_15 AC 86 ms
80,696 KB
testcase_16 AC 85 ms
80,340 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 84 ms
79,896 KB
testcase_21 AC 560 ms
81,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

from pprint import pprint
from sys import setrecursionlimit, stdin
from typing import Dict, Iterable, Set

INF: int = 1 << 62
setrecursionlimit(1_000_000)


def inputs(type_=int):
    ins = input().split(' ')
    ins = [x for x in ins if x != '']

    if isinstance(type_, Iterable):
        return [t(x) for t, x in zip(type_, ins)]
    else:
        return list(map(type_, ins))


def input_(type_=int):
    a, = inputs(type_)
    return a


inputi = input_


def inputstr():
    return input_(str)


def answer(res) -> None:
    print(res)
    exit()


# start coding
n, w = inputs()
A = inputs()

from itertools import product

set_ = set()
for it in product(range(3), repeat=n):
    s = 0
    t = []
    for i, f in enumerate(it):
        if f == 1:
            s += A[i] // 2
            t.append(i)
        elif f == 2:
            s += A[i]
            t.append(i)
    if s == w:
        set_.add(tuple(t))

print(len(set_))
0