結果
問題 |
No.3001 ヘビ文字列
|
ユーザー |
![]() |
提出日時 | 2025-01-02 00:14:48 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 800 bytes |
コンパイル時間 | 853 ms |
コンパイル使用メモリ | 82,424 KB |
実行使用メモリ | 276,440 KB |
最終ジャッジ日時 | 2025-01-02 00:16:22 |
合計ジャッジ時間 | 80,162 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 60 TLE * 23 |
ソースコード
from collections import Counter import sys input = sys.stdin.readline S=input().strip() 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))