結果
問題 | No.3001 ヘビ文字列 |
ユーザー |
![]() |
提出日時 | 2025-01-02 00:12:56 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 792 bytes |
コンパイル時間 | 309 ms |
コンパイル使用メモリ | 82,660 KB |
実行使用メモリ | 258,352 KB |
最終ジャッジ日時 | 2025-01-02 00:14:13 |
合計ジャッジ時間 | 74,363 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 83 |
ソースコード
from collections import Counterimport sysinput = sys.stdin.readlineS=input()LEN=len(S)C=Counter(S)ANS=LENind=-1for a in C:x=C[a]if ANS>LEN-x:ANS=LEN-xind=[a]x=LENfor t in range(2,LEN):if x%t==0:while x%t==0:x//=tdis=LEN//tscore=0L=[]for i in range(dis):C=Counter()for j in range(t):C[S[j*dis+i]]+=1MAX=0indm=""for c in C:if MAX<C[c]:MAX=C[c]indm=cscore+=t-MAXL.append(indm)if score<ANS:ANS=scoreind=LLANS=ind*(LEN//len(ind))print("".join(LANS))