結果
| 問題 |
No.2751 429-like Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-10 22:42:24 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 5,341 bytes |
| コンパイル時間 | 3,204 ms |
| コンパイル使用メモリ | 157,912 KB |
| 実行使用メモリ | 10,020 KB |
| 最終ジャッジ日時 | 2024-12-20 06:37:37 |
| 合計ジャッジ時間 | 14,200 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 21 TLE * 1 |
ソースコード
#include <algorithm>
#include <atcoder/all>
#include <climits>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using namespace atcoder;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;
typedef pair<ll, ll> pll;
typedef pair<ll, string> pls;
typedef pair<string, ll> psl;
typedef pair<float, float> pff;
typedef pair<double, double> pdd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<float> vf;
typedef vector<vector<float>> vvf;
typedef vector<vector<vector<float>>> vvvf;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<pii> vpii;
typedef vector<vector<pii>> vvpii;
typedef vector<vector<vector<pii>>> vvvpii;
typedef vector<pll> vpll;
typedef vector<vector<pll>> vvpll;
typedef vector<vector<vector<pll>>> vvvpll;
typedef unordered_map<char, char> umcc;
typedef unordered_map<char, int> umci;
typedef unordered_map<char, ll> umcll;
typedef unordered_map<char, string> umcs;
typedef unordered_map<int, char> umic;
typedef unordered_map<int, int> umii;
typedef unordered_map<int, ll> umill;
typedef unordered_map<int, string> umis;
typedef unordered_map<ll, ll> umllll;
typedef unordered_map<ll, string> umlls;
typedef unordered_map<string, char> umsc;
typedef unordered_map<string, int> umsi;
typedef unordered_map<string, ll> umsll;
typedef unordered_set<char> usc;
typedef unordered_set<int> usi;
typedef unordered_set<ll> usll;
typedef unordered_set<string> uss;
const double PI = 3.141592653589793;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repe(i, n) for (int i = 0; i <= (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i < (int)(n); ++i)
#define rep1e(i, n) for (int i = 1; i <= (int)(n); ++i)
#define repab(i, a, b) for (int i = (a); i < (b); ++i)
#define repabe(i, a, b) for (int i = (a); i <= (b); ++i)
#define mod107(m) m % 1000000007
#define mod998(m) m % 998244353
const ll m107 = 1000000007;
const ll m998 = 998244353;
// 数値を16桁で表示(誤差が厳しい問題に対応)
#define cout16 std::cout << std::fixed << std::setprecision(16)
// endl no flush (flush処理は重たい)
#define elnf "\n"
// 競プロ用環境セッティング
void preprocess() {
std::cin.tie(nullptr);
std::ios_base::sync_with_stdio(false);
} // end of func
template <class T>
void printvec(const vector<T> &vec) {
rep(i, vec.size()) cout << vec[i] << " ";
cout << endl;
} // end of func
template <class T>
void printvvec(const vector<T> &vec) {
rep(i, vec.size()) {
rep(j, vec[i].size()) cout << vec[i][j] << " ";
cout << endl;
}
} // end of func
const bool debug = true;
int main() {
preprocess();
int n;
cin >> n;
rep(_, n) {
ll a;
cin >> a;
ll sq;
bool flag;
sq = ceil(sqrt(a));
flag = false;
if (a % 2ll == 0) {
a >>= 1;
flag = true;
} else {
for (ll p = 3; p <= sq; p += 2) {
if (a % p == 0) {
flag = true;
a /= p;
break;
}
}
}
if (flag == false) {
cout << "No\n";
continue;
}
sq = ceil(sqrt(a));
flag = false;
if (a % 2 == 0) {
a >>= 1;
flag = true;
} else {
for (ll p = 3; p <= sq; p += 2) {
if (a % p == 0) {
flag = true;
a /= p;
break;
}
}
}
if (flag == false || a == 1) {
cout << "No\n";
continue;
}
if (a == 2) {
cout << "Yes\n";
continue;
}
sq = ceil(sqrt(a));
flag = false;
if (a % 2 == 0) {
flag = true;
} else {
for (ll p = 3; p <= sq; p += 2) {
if (a % p == 0) {
flag = true;
break;
}
}
}
if (flag)
cout << "No\n";
else
cout << "Yes\n";
}
return 0;
} // end of main