結果
問題 | 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 Counterimport sysinput = sys.stdin.readlineS=input().strip()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))