結果

問題 No.2074 Product is Square ?
ユーザー suisui
提出日時 2022-09-16 23:34:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,520 bytes
コンパイル時間 4,145 ms
コンパイル使用メモリ 262,388 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-23 16:50:57
合計ジャッジ時間 9,652 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 58 ms
4,376 KB
testcase_12 AC 142 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 57 ms
4,380 KB
testcase_16 AC 147 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 56 ms
4,380 KB
testcase_20 AC 147 ms
4,376 KB
testcase_21 WA -
testcase_22 AC 143 ms
4,376 KB
testcase_23 AC 57 ms
4,376 KB
testcase_24 AC 147 ms
4,376 KB
testcase_25 WA -
testcase_26 AC 142 ms
4,376 KB
testcase_27 AC 57 ms
4,380 KB
testcase_28 AC 145 ms
4,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n+1); i++)
#define repn(i,a,b) for (int i = (int)(a) ; i < (int)(b+1); i++)
#define repv(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) ((int)(x).size())
#define cauto const auto&
#define bit(n) (1LL<<(n))
#define uni(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using P = pair<ll,ll>;
using PP = pair<int, P>;
using Graph = vector<vector<int>>;
using mint = modint998244353;
#ifdef LOCAL
    #include <debug.hpp>
    #define debug(...) debug::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
    #define debug(...) (static_cast<void>(0))
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int quary;
    cin >> quary;
    rep(_,quary){
        ll n;
        cin >> n;
        vector<ll> a(n);
        rep(i,n) cin >> a[i];
        rep(i,n){
            repn(j,i+1,n-1){
                ll gcd = __gcd(a[i],a[j]);
                if(gcd != 1){
                    a[i] /= gcd;
                    a[j] /= gcd;
                }
            }
        }
        bool ok = true;
        rep(i,n){
            int s = sqrt(a[i]);
            if(s*s != a[i]){
                ok = false;
                break;
            }
        }
        cout << (ok ? "Yes" : "No") << "\n";
    }
    return 0;
}
0