結果

問題 No.295 hel__world
ユーザー convexineqconvexineq
提出日時 2021-01-02 10:54:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 970 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 82,508 KB
実行使用メモリ 82,840 KB
最終ジャッジ日時 2024-04-20 05:36:51
合計ジャッジ時間 7,965 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
54,684 KB
testcase_01 AC 38 ms
52,864 KB
testcase_02 AC 40 ms
52,736 KB
testcase_03 AC 39 ms
52,864 KB
testcase_04 AC 38 ms
52,608 KB
testcase_05 WA -
testcase_06 AC 39 ms
52,608 KB
testcase_07 AC 38 ms
52,608 KB
testcase_08 AC 42 ms
52,864 KB
testcase_09 AC 38 ms
53,120 KB
testcase_10 AC 40 ms
52,864 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 37 ms
52,608 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
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 #

*a, = map(int,input().split())
d = {}
t = input()+"Z"
ren = -1
cnt = 0
now = "A"
for i in t:
    if i == now:
        cnt += 1
    else:
        if now in d: d[now].append(cnt)
        else: d[now] = [cnt]
        now = i
        cnt = 1
        ren += 1
V = [0]*26
from heapq import *
for i,ai in enumerate(a):
    s = chr(i+97)
    if ai==0 or (ai != 0 and s not in d): continue
    ds = d[s]
    v = ai - sum(ds)
    V[i] = v
    if v < 0:
        print(0)
        exit()

ans = 1
MAX = 1<<62
for i,ai in enumerate(a):
    s = chr(i+97)
    if ai==0 or (ai != 0 and s not in d): continue
    v = V[i]
    if v==0:
        continue
    # 倍率、先頭、長さ    
    q = [(-(i+1.0),i,i) for i in d[s]]
    heapify(q)
    #print(chr(i+97),v,d[chr(i+97)])
    for _ in range(v):
        _,x,y = heappop(q)
        ans = ans*(y+1)//(y-x+1)
        heappush(q,(-(y+2)/(y+2-x),x,y+1))        
        if ans > MAX:
            print("hel")
            exit()
print(ans)
0