結果

問題 No.412 花火大会
ユーザー はむ吉🐹はむ吉🐹
提出日時 2017-02-12 20:01:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 8,764 KB
最終ジャッジ日時 2023-08-28 14:54:14
合計ジャッジ時間 1,787 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,636 KB
testcase_01 AC 18 ms
8,764 KB
testcase_02 AC 19 ms
8,664 KB
testcase_03 AC 18 ms
8,628 KB
testcase_04 AC 18 ms
8,672 KB
testcase_05 AC 18 ms
8,624 KB
testcase_06 AC 18 ms
8,596 KB
testcase_07 AC 18 ms
8,684 KB
testcase_08 AC 18 ms
8,672 KB
testcase_09 AC 18 ms
8,628 KB
testcase_10 AC 18 ms
8,632 KB
testcase_11 AC 18 ms
8,628 KB
testcase_12 AC 18 ms
8,592 KB
testcase_13 AC 18 ms
8,604 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 18 ms
8,576 KB
testcase_17 AC 18 ms
8,596 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 18 ms
8,744 KB
testcase_21 AC 19 ms
8,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import bisect
import collections


def solve(bcd, es):
    def p2(x):
        return 1 << x
    reqs = sorted(bcd)
    s = collections.Counter(bisect.bisect(reqs, e) for e in es)
    res = p2(s[0]) * (p2(s[1]) - 1) * (p2(s[2]) - 1) * (p2(s[3]) - 1)
    res += p2(s[0]) * (p2(s[1]) - 1) * (p2(s[3]) - 1 - s[3])
    res += p2(s[0]) * (p2(s[2]) - 1 - s[2]) * (p2(s[3]) - 1)
    res += p2(s[0]) * (p2(s[2]) - 1) * (p2(s[3]) - 1 - s[3])
    res += p2(s[0]) * (p2(s[3]) - 1 - s[3] - s[3] * (s[3] - 1) // 2)
    return res


def main():
    bcd = (int(x) for x in input().split())
    _ = input()
    es = (int(x) for x in input().split())
    print(solve(bcd, es))


if __name__ == '__main__':
    main()
0