結果
| 問題 | 
                            No.8081 HQ9+
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-04-01 20:21:07 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 674 bytes | 
| コンパイル時間 | 1,432 ms | 
| コンパイル使用メモリ | 166,192 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-12-18 02:00:10 | 
| 合計ジャッジ時間 | 2,187 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 15 WA * 6 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
#define pow(n,m) powl(n,m);
#define sqrt(n) sqrtl(n);
const ll MAX = 5000000000000000000;
const ll MOD = 1000000007;
//998244353;
void randinit(){srand((unsigned)time(NULL));}
int main(){
    ll N;
    string S;
    cin >> N >> S;
    for(ll i = 0;i < N;i++){
        if(S[i] != 'Q'){
            cout << -1 << endl;
            return 0;
        }
    }
    for(ll i = 0;i <= N;i++){
        if(i * i == N){
            for(ll j = 0;j < i;j++){
                cout << "Q";
            }
            cout << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}