結果

問題 No.3081 HQ9+
ユーザー kit84kit84
提出日時 2021-04-01 22:11:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 319 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 8,328 KB
最終ジャッジ日時 2023-08-23 06:10:02
合計ジャッジ時間 1,413 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,824 KB
testcase_01 AC 17 ms
7,824 KB
testcase_02 AC 16 ms
7,804 KB
testcase_03 AC 15 ms
7,816 KB
testcase_04 AC 16 ms
7,872 KB
testcase_05 AC 16 ms
7,828 KB
testcase_06 AC 15 ms
7,816 KB
testcase_07 AC 15 ms
7,780 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 15 ms
7,772 KB
testcase_12 AC 16 ms
7,796 KB
testcase_13 AC 15 ms
7,832 KB
testcase_14 AC 15 ms
7,816 KB
testcase_15 AC 16 ms
7,832 KB
testcase_16 AC 17 ms
7,876 KB
testcase_17 AC 16 ms
7,824 KB
testcase_18 AC 16 ms
8,248 KB
testcase_19 AC 16 ms
7,896 KB
testcase_20 AC 17 ms
8,192 KB
testcase_21 AC 17 ms
8,328 KB
testcase_22 AC 16 ms
8,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

#N,M = map(int,input().split())
#print(N)

N = int(input())
S = input().rstrip()

if S.count("Q")==1 and \
   "H" not in S and \
   "9" not in S:
	print(S)
elif S.count("Q")==N:
	m = 0
	n = 1
	while m*m < N:
		m += 1
	if m*m==N:
		print("Q"*m)
	else:
		print(-1)
else:
	print(-1)
0