結果
問題 | No.8081 HQ9+ |
ユーザー |
![]() |
提出日時 | 2021-03-10 11:35:17 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 239 bytes |
コンパイル時間 | 87 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-10-12 08:46:44 |
合計ジャッジ時間 | 1,607 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
N=int(input())S=input()Q=0H=Falsefor c in S:if c=='Q':Q+=1if c=='H':H=TrueK=int(Q**0.5)if not H and Q>0 and K*K==Q and N%K==0:ok=Truefor i in range(N-N//K):ok&=S[i]==S[i+N//K]if ok:print(S[:N//K])exit(0)print(-1)