結果

問題 No.3081 HQ9+
ユーザー googol_S0googol_S0
提出日時 2021-04-01 21:30:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 76,268 KB
最終ジャッジ日時 2024-06-01 03:18:16
合計ジャッジ時間 2,168 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,224 KB
testcase_01 AC 40 ms
52,160 KB
testcase_02 AC 37 ms
52,112 KB
testcase_03 AC 37 ms
53,632 KB
testcase_04 AC 39 ms
53,764 KB
testcase_05 AC 37 ms
52,084 KB
testcase_06 AC 38 ms
52,344 KB
testcase_07 AC 38 ms
52,612 KB
testcase_08 AC 46 ms
61,372 KB
testcase_09 AC 38 ms
53,580 KB
testcase_10 AC 38 ms
53,668 KB
testcase_11 AC 37 ms
52,512 KB
testcase_12 AC 38 ms
52,364 KB
testcase_13 AC 44 ms
59,872 KB
testcase_14 AC 47 ms
62,740 KB
testcase_15 AC 45 ms
61,552 KB
testcase_16 AC 47 ms
63,204 KB
testcase_17 AC 48 ms
63,696 KB
testcase_18 AC 62 ms
75,656 KB
testcase_19 AC 46 ms
62,340 KB
testcase_20 AC 86 ms
76,268 KB
testcase_21 AC 85 ms
75,740 KB
testcase_22 AC 85 ms
76,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x):
  if 'H' in x:
    return 1000000
  if '9' in x:
    return 1000000
  return x.count('Q')

N=int(input())
S=input()
for i in range(1,N+1):
  if N%i:
    continue
  F=1
  for j in range(i,N,i):
    for k in range(i):
      if S[k]!=S[j+k]:
        F=0
  if F:
    if f(S[:i])*i==N:
      print(S[:i])
      exit()
print(-1)
0