結果
問題 | No.2074 Product is Square ? |
ユーザー |
![]() |
提出日時 | 2022-09-17 14:01:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 745 bytes |
コンパイル時間 | 2,093 ms |
コンパイル使用メモリ | 203,332 KB |
最終ジャッジ日時 | 2025-02-07 11:18:33 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 WA * 13 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)#define ALL(v) v.begin(),v.end()typedef long long ll;#include <bits/stdc++.h>using namespace std;int main(){ios::sync_with_stdio(false);std::cin.tie(nullptr);vector<int> B={3,5,7,11,13,17,19,23,29,31,37,41,43,47};int a=B.size();vector<set<int>> C(a);rep(i,a){int j=0;while(C[i].size()<(B[i]+1)/2){C[i].insert(j*j%B[i]);j++;}}int t;cin>>t;while(t--){int n;cin>>n;vector<ll> A(n);rep(i,n) cin>>A[i];bool b=true;rep(i,a){ll tmp=1;rep(j,n) tmp=tmp*(A[j]%B[i])%B[i];if(C[i].count(tmp)==0) b=false;}if(b) cout<<"Yes"<<endl;else cout<<"No"<<endl;}return 0;}