結果

問題 No.3081 HQ9+
ユーザー shiomusubi496shiomusubi496
提出日時 2021-04-01 21:42:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 1,553 ms
コンパイル使用メモリ 167,692 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-01 03:28:14
合計ジャッジ時間 2,349 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 4 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 4 ms
6,940 KB
testcase_21 AC 5 ms
6,940 KB
testcase_22 AC 5 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    string S;
    cin>>N>>S;
    int Q=count(S.begin(),S.end(),'Q');
    if(Q==0)return puts("-1"),0;
    if(N%Q)return puts("-1"),0;
    for(int i=0;i<N/Q;i++){
        for(int j=0;j<Q;j++){
            if(S[i]!=S[i+j*(N/Q)])return puts("-1"),0;
        }
    }
    cout<<S.substr(0,N/Q)<<endl;
}
0