結果
| 問題 | No.8081 HQ9+ |
| コンテスト | |
| ユーザー |
kit84
|
| 提出日時 | 2021-04-01 22:42:47 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 95 ms / 2,000 ms |
| コード長 | 362 bytes |
| 記録 | |
| コンパイル時間 | 383 ms |
| コンパイル使用メモリ | 20,832 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-05-27 23:41:39 |
| 合計ジャッジ時間 | 3,537 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
import sys
input = sys.stdin.readline
#N,M = map(int,input().split())
#print(N)
N = int(input())
S = input().rstrip()
nQ = S.count("Q")
if "H" in S or \
"9" in S:
print(-1)
elif nQ==1:
print(S)
elif nQ>1:
m = 0
while m*m < nQ:
m += 1
if m*m==nQ:
T = S[:(N//m)]
if T*m == S:
print(T)
else:
print(-1)
else:
print(-1)
else:
print(-1)
kit84