結果

問題 No.8081 HQ9+
ユーザー shiomusubi496shiomusubi496
提出日時 2021-04-01 21:38:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 332 bytes
コンパイル時間 1,848 ms
コンパイル使用メモリ 168,124 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-21 05:58:18
合計ジャッジ時間 3,120 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 1
other AC * 10 WA * 8 RE * 3
権限があれば一括ダウンロードができます

ソースコード

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(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