結果

問題 No.295 hel__world
ユーザー convexineqconvexineq
提出日時 2021-01-02 10:59:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,024 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 109,916 KB
最終ジャッジ日時 2024-04-20 05:42:08
合計ジャッジ時間 4,792 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,740 KB
testcase_01 AC 40 ms
53,280 KB
testcase_02 AC 39 ms
53,884 KB
testcase_03 AC 39 ms
53,556 KB
testcase_04 AC 39 ms
54,188 KB
testcase_05 WA -
testcase_06 AC 42 ms
52,892 KB
testcase_07 AC 39 ms
53,604 KB
testcase_08 AC 39 ms
53,220 KB
testcase_09 AC 40 ms
53,360 KB
testcase_10 AC 39 ms
53,384 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 40 ms
54,792 KB
testcase_14 AC 40 ms
53,500 KB
testcase_15 AC 42 ms
53,664 KB
testcase_16 WA -
testcase_17 AC 39 ms
54,064 KB
testcase_18 AC 40 ms
53,408 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 39 ms
53,832 KB
testcase_26 AC 39 ms
53,332 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 39 ms
53,948 KB
testcase_30 AC 38 ms
53,352 KB
testcase_31 AC 40 ms
54,864 KB
testcase_32 AC 207 ms
109,916 KB
testcase_33 AC 178 ms
109,864 KB
testcase_34 AC 202 ms
109,828 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 39 ms
53,864 KB
testcase_43 AC 38 ms
52,712 KB
testcase_44 AC 38 ms
52,960 KB
testcase_45 AC 39 ms
53,044 KB
testcase_46 AC 39 ms
52,896 KB
testcase_47 AC 39 ms
53,200 KB
testcase_48 AC 38 ms
52,684 KB
testcase_49 AC 39 ms
53,404 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 68 ms
78,916 KB
testcase_54 AC 68 ms
78,908 KB
testcase_55 AC 73 ms
78,608 KB
testcase_56 AC 73 ms
78,976 KB
権限があれば一括ダウンロードができます

ソースコード

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
    # 倍率、先頭、長さ    
    if v > 62:
        print("hel")
        exit()
    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