結果

問題 No.2074 Product is Square ?
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-08-05 20:42:01
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 820 bytes
コンパイル時間 5,735 ms
コンパイル使用メモリ 335,780 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-23 17:11:56
合計ジャッジ時間 9,130 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 5 ms
6,940 KB
testcase_02 AC 4 ms
6,940 KB
testcase_03 AC 4 ms
6,940 KB
testcase_04 AC 4 ms
6,940 KB
testcase_05 AC 4 ms
6,944 KB
testcase_06 AC 4 ms
6,940 KB
testcase_07 AC 4 ms
6,940 KB
testcase_08 AC 5 ms
6,940 KB
testcase_09 AC 5 ms
6,940 KB
testcase_10 AC 5 ms
6,944 KB
testcase_11 AC 68 ms
6,944 KB
testcase_12 AC 94 ms
6,944 KB
testcase_13 AC 225 ms
6,940 KB
testcase_14 AC 97 ms
6,940 KB
testcase_15 AC 67 ms
6,944 KB
testcase_16 AC 97 ms
6,940 KB
testcase_17 AC 229 ms
6,944 KB
testcase_18 AC 96 ms
6,940 KB
testcase_19 AC 69 ms
6,940 KB
testcase_20 AC 97 ms
6,944 KB
testcase_21 AC 224 ms
6,944 KB
testcase_22 AC 100 ms
6,940 KB
testcase_23 AC 68 ms
6,940 KB
testcase_24 AC 95 ms
6,944 KB
testcase_25 AC 221 ms
6,940 KB
testcase_26 AC 97 ms
6,940 KB
testcase_27 AC 68 ms
6,940 KB
testcase_28 AC 93 ms
6,940 KB
testcase_29 AC 217 ms
6,944 KB
testcase_30 AC 97 ms
6,940 KB
testcase_31 AC 2 ms
6,944 KB
testcase_32 AC 2 ms
6,940 KB
testcase_33 AC 3 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
bool f(ll a){
	ll wa=0,ac=1e9;
	while(ac-wa>1){
		ll x=(ac+wa)/2;
		if(x*x>=a)ac=x;
		else wa=x;
	}
	if(ac*ac==a)return true;
	else return false;
}
int main(){
	int t;cin>>t;
	rep(z,t){
		int n;cin>>n;
		vc<ll>v(n); rep(i,n)cin>>v[i];
		rep(i,n)rep(j,i){
			ll g=gcd(v[i],v[j]);
			v[i]/=g,v[j]/=g;
		}
		bool ok=true; rep(i,n)if(!f(v[i]))ok=false;
		if(ok)cout<<"Yes";
		else cout<<"No";
		cout<<"\n";
	}
}
0