結果
問題 |
No.3001 ヘビ文字列
|
ユーザー |
![]() |
提出日時 | 2025-01-02 00:10:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 753 bytes |
コンパイル時間 | 338 ms |
コンパイル使用メモリ | 82,408 KB |
実行使用メモリ | 276,452 KB |
最終ジャッジ日時 | 2025-01-02 00:12:02 |
合計ジャッジ時間 | 87,406 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 63 TLE * 20 |
ソースコード
from collections import Counter S=input() LEN=len(S) C=Counter(S) ANS=LEN ind=-1 for a in C: x=C[a] if ANS>LEN-x: ANS=LEN-x ind=[a] x=LEN for t in range(2,LEN): if x%t==0: while x%t==0: x//=t dis=LEN//t score=0 L=[] for i in range(dis): C=Counter() for j in range(t): C[S[j*dis+i]]+=1 MAX=0 indm="" for c in C: if MAX<C[c]: MAX=C[c] indm=c score+=t-MAX L.append(indm) if score<ANS: ANS=score ind=L LANS=ind*(LEN//len(ind)) print("".join(LANS))