結果

問題 No.3081 HQ9+
ユーザー KudeKude
提出日時 2021-04-01 21:53:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 256 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 76,076 KB
最終ジャッジ日時 2023-08-23 05:56:49
合計ジャッジ時間 3,071 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,384 KB
testcase_01 AC 74 ms
71,364 KB
testcase_02 AC 74 ms
71,280 KB
testcase_03 AC 77 ms
71,500 KB
testcase_04 AC 72 ms
71,312 KB
testcase_05 AC 74 ms
71,328 KB
testcase_06 AC 72 ms
71,424 KB
testcase_07 AC 73 ms
71,268 KB
testcase_08 AC 72 ms
71,556 KB
testcase_09 AC 72 ms
71,280 KB
testcase_10 AC 72 ms
71,228 KB
testcase_11 AC 73 ms
71,176 KB
testcase_12 AC 72 ms
71,176 KB
testcase_13 AC 73 ms
71,588 KB
testcase_14 AC 75 ms
76,076 KB
testcase_15 AC 73 ms
71,388 KB
testcase_16 AC 76 ms
76,048 KB
testcase_17 AC 73 ms
71,220 KB
testcase_18 AC 73 ms
71,320 KB
testcase_19 AC 74 ms
71,312 KB
testcase_20 AC 71 ms
71,232 KB
testcase_21 AC 73 ms
71,176 KB
testcase_22 AC 72 ms
71,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
if 'H' in s:
    print(-1)
    exit()
#[0, r)
cnt = 0
for r in range(1, n + 1):
    cnt += s[r-1] == 'Q'
    if cnt * r == n:
        code = s[:r]
        if code * cnt == s:
            print(code)
            exit()
print(-1)
0