結果
問題 | No.2379 Burnside's Theorem |
ユーザー |
|
提出日時 | 2023-07-14 21:26:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,495 bytes |
コンパイル時間 | 2,191 ms |
コンパイル使用メモリ | 219,564 KB |
最終ジャッジ日時 | 2025-02-15 10:37:03 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define display(a) {for(int i=0;i<a.size();i++) cout<<a[i]<<" "; cout<<endl;} using ll = long long; #define all(v) v.begin(),v.end() #define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());} #define pb push_back #define ff first #define ss second #define endl "\n" #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL) #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #ifndef ONLINE_JUDGE #define debug(x) cerr << #x <<" "; _print(x); cerr << endl; #else #define debug(x) #endif void _print(ll t) {cerr << t;} void _print(int t) {cerr << t;} void _print(string t) {cerr << t;} void _print(char t) {cerr << t;} void _print(double t) {cerr << t;} template <class T, class V> void _print(pair <T, V> p); template <class T> void _print(vector <T> v); template <class T> void _print(set <T> v); template <class T, class V> void _print(map <T, V> v); template <class T> void _print(multiset <T> v); template<class T> void _print(queue<T> q); template<class T> void _print(stack<T> stk); template<class T> void _print(priority_queue<T> pq); template<class T> void _print(priority_queue<T, vector<T>, greater<T>> pq); template<class T> void _print(deque<T> dq); const int N=1e6+10; vector<bool> isprime(N,1); vector<int> primes; void seive(){ isprime[0]=isprime[1]=0; for(int i=2;i<N;i++){ if(!isprime[i]) continue; for(int j=2*i;j<N;j+=i){ isprime[j]=0; } } for(int i=0;i<N;i++){ if(isprime[i]) primes.pb(i); } } void solve(){ ll n;cin>>n; int c=0; for(auto i : primes){ if(n%i) continue; c++; while(n%i==0){ n/=i; } } if(n>1) c++; if(c<=2){ cout<<"YES\n"; }else cout<<"NO\n"; } int main(){ seive(); fast_io;int t=1; // cin>>t; while(t--){ solve(); } } template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";} template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";} template<class T> void _print(queue<T> q){cerr << "[";while (!q.empty()){T i = q.front();q.pop();cerr << i;cerr << " ";}cerr << "]";} template<class T> void _print(stack<T> st){cerr << "[";while (!st.empty()){_print(st.top());st.pop();cerr << " ";}cerr << "]";} template<class T> void _print(priority_queue<T> pq){cerr << "[";while (!pq.empty()){_print(pq.top());pq.pop();cerr << " ";}cerr << "]";} template<class T> void _print(priority_queue<T, vector<T>, greater<T>> pq){cerr << "[";while (!pq.empty()){_print(pq.top());pq.pop();cerr << " ";}cerr << "]";} template<class T> void _print(deque<T> dq){cerr << "[";for (T i : dq){_print(i);cerr << " ";}cerr << "]";}