Problems Submissions
Register Login 質問(Gitter) GitHub

Submit Info #3691

Problem Lang User Status Time Memory
Factorize cpp14 shiro53 TLE 10000 ms 0.64 MiB

ケース詳細
Name Status Time Memory
big2_00 TLE 10000 ms -1 Mib
big2_01 TLE 10000 ms -1 Mib
big2_02 TLE 10000 ms -1 Mib
example_00 AC 7 ms 0.64 MiB
random_00 TLE 10000 ms -1 Mib
random_01 TLE 10000 ms -1 Mib
random_02 TLE 10000 ms -1 Mib
small_00 AC 5 ms 0.64 MiB
small_01 AC 5 ms 0.63 MiB
small_02 AC 5 ms 0.62 MiB

#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return 1; } return 0; } typedef long long int ll; #define ALL(v) (v).begin(), (v).end() #define RALL(v) (v).rbegin(), (v).rend() #define endl "\n" const double EPS = 1e-7; const int INF = 1 << 30; const ll LLINF = 1LL << 60; const double PI = acos(-1); const int MOD = 1000000007; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; //------------------------------------- map<ll, int> prime_factor(ll n) { map<ll, int> ret; for(ll i = 2; i * i <= n; i++) { while(n % i == 0) { ret[i]++; n /= i; } } if(n != 1) ret[n] = 1; return ret; } int main() { cin.tie(0); ios::sync_with_stdio(false); int q; cin >> q; while(q--) { ll a; cin >> a; auto mp = prime_factor(a); ll cnt = 0; vector<ll> v; for(auto p : mp) { for(ll i = 0; i < p.second; i++) { v.emplace_back(p.first); } } cout << v.size() << ' '; for(ll i = 0; i < v.size(); i++) { cout << v[i] << ' '; } cout << endl; } }