結果

問題 No.3081 HQ9+
ユーザー chineristACchineristAC
提出日時 2021-04-01 20:55:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 441 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 76,364 KB
最終ジャッジ日時 2023-08-23 04:49:14
合計ジャッジ時間 3,007 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
76,148 KB
testcase_01 AC 73 ms
75,968 KB
testcase_02 AC 71 ms
75,944 KB
testcase_03 AC 71 ms
76,032 KB
testcase_04 AC 76 ms
76,044 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 73 ms
75,976 KB
testcase_09 AC 72 ms
76,240 KB
testcase_10 AC 73 ms
76,232 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 72 ms
76,212 KB
testcase_15 AC 70 ms
76,060 KB
testcase_16 AC 73 ms
76,028 KB
testcase_17 AC 72 ms
76,032 KB
testcase_18 AC 72 ms
76,076 KB
testcase_19 AC 73 ms
75,972 KB
testcase_20 AC 72 ms
76,140 KB
testcase_21 AC 71 ms
76,236 KB
testcase_22 AC 72 ms
75,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

sq = {i**2:i for i in range(10**4)}

N = int(input())
S = input()
k = S.count("Q")
if not k:
    print(-1)
else:
    if not k in sq:
        print(-1)
    else:
        Q_cnt = sq[k]
        if N%Q_cnt:
            print(-1)
        else:
            L = N//Q_cnt
            T = [S[i:i+L] for i in range(0,N,L)]
            if all(T[0]==T[i] for i in range(len(T))):
                print(T[0])
            else:
                print(-1)
0