結果
| 問題 | No.295 hel__world |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-06-26 03:36:48 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 984 bytes |
| 記録 | |
| コンパイル時間 | 161 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 86,784 KB |
| 最終ジャッジ日時 | 2026-06-26 03:37:18 |
| 合計ジャッジ時間 | 7,610 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 10 WA * 1 TLE * 1 -- * 41 |
ソースコード
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
A=list(map(int,input().split()))
T=input().strip()
T2=[ord(t)-97 for t in T]
B=[0]*26
for t in T2:
B[t]+=1
for i in range(26):
if A[i]<B[i]:
print(0)
exit()
LIST=[[] for i in range(26)]
count=0
now=-1
for i in range(len(T2)):
if i-1>=0 and T2[i]==T2[i-1]:
count+=1
else:
if now!=-1:
LIST[now].append(count)
count=1
now=T2[i]
if now!=-1:
LIST[now].append(count)
#print(LIST)
def calc(L,k):
rest=k-sum(L)
Q=[]
for x in L:
heappush(Q,(-(x+1),x+1,1))
for i in range(rest):
#print(Q)
com,x,y=heappop(Q)
ANS[0]=ANS[0]*x//y
x+=1
y+=1
heappush(Q,(-x/y,x,y))
if ANS[0]>(2**62):
print("hel")
exit()
ANS=[1]
for i in range(26):
if LIST[i]==[]:
continue
calc(LIST[i],A[i])
print(ANS[0])
titia