結果

問題 No.8081 HQ9+
ユーザー shiomusubi496shiomusubi496
提出日時 2021-04-01 21:42:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 1,660 ms
コンパイル使用メモリ 168,116 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-21 06:00:07
合計ジャッジ時間 2,297 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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