結果

問題 No.295 hel__world
ユーザー convexineqconvexineq
提出日時 2021-01-02 12:17:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 968 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 84,344 KB
最終ジャッジ日時 2024-04-20 07:05:55
合計ジャッジ時間 10,574 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,488 KB
testcase_01 AC 43 ms
54,528 KB
testcase_02 AC 42 ms
54,656 KB
testcase_03 AC 43 ms
54,528 KB
testcase_04 AC 44 ms
54,400 KB
testcase_05 AC 44 ms
54,272 KB
testcase_06 AC 43 ms
54,656 KB
testcase_07 AC 43 ms
54,272 KB
testcase_08 AC 43 ms
54,144 KB
testcase_09 AC 46 ms
54,528 KB
testcase_10 AC 46 ms
54,528 KB
testcase_11 AC 42 ms
54,272 KB
testcase_12 AC 47 ms
54,528 KB
testcase_13 AC 47 ms
54,528 KB
testcase_14 AC 48 ms
54,656 KB
testcase_15 AC 47 ms
54,272 KB
testcase_16 AC 43 ms
54,272 KB
testcase_17 AC 42 ms
54,144 KB
testcase_18 AC 44 ms
54,528 KB
testcase_19 AC 41 ms
54,400 KB
testcase_20 AC 41 ms
54,016 KB
testcase_21 AC 42 ms
54,272 KB
testcase_22 AC 40 ms
54,400 KB
testcase_23 AC 41 ms
54,400 KB
testcase_24 AC 92 ms
76,608 KB
testcase_25 AC 76 ms
76,928 KB
testcase_26 AC 89 ms
76,904 KB
testcase_27 AC 40 ms
54,016 KB
testcase_28 AC 1,777 ms
76,416 KB
testcase_29 TLE -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import groupby
from collections import defaultdict
from heapq import *
*a, = map(int,input().split())
d = defaultdict(list)
t = input()
for k,v in groupby(t):
    d[k].append(len(list(v)))

def get(ai,lst):
    if not lst: return 1
    res = 1
    v = ai - sum(lst)
    if v < 0: return 0
    lst = sorted(lst,reverse=True)[:65]
    q = [(-(i+1.0),i,i) for i in lst] # 倍率、先頭、長さ
    if len(q) == 1:
        c = lst[0]
        for i in range(min(c,ai-c)):
            res *= ai-i
            res //= i+1
            if res >= MAX: return MAX
        return res
    if len(q) == 2 == sum(lst):
        return min(ai//2*((ai+1)//2),MAX)
    heapify(q)
    for _ in range(v):
        __,x,y = heappop(q)
        res = res*(y+1)//(y-x+1)
        heappush(q,(-(y+2)/(y+2-x),x,y+1))
        if res >= MAX: return res
    return res

ans = 1
MAX = 1<<62
for i,ai in enumerate(a):
    ans *= get(ai,d[chr(i+97)])
print(ans if ans < MAX else "hel")
0