# Submit Info #2625

Problem Lang User Status Time Memory
Factorize cpp mdstoy TLE 10000 ms 0.67 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 6 ms 0.55 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 6 ms 0.59 MiB
small_01 AC 6 ms 0.67 MiB
small_02 AC 5 ms 0.59 MiB

#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define FOR(i, m, n) for (int i = (m); i < (n); i++) #define FORR(i, m, n) for (int i = (m); i >= (n); i--) #define REP(i, n) FOR(i, 0, (n)) #define REPR(i, n) FORR(i, (n) - 1, 0) #define REP1(i, n) FOR(i, 1, (n) + 1) #define REPS(c, s) for (char c : s) #define ALL(c) (c).begin(), (c).end() #define sz(v) (int)v.size() template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;} template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} const int MOD = 1000000007; const int INF = 1000000001; const ll LINF = 1000000001000000001LL; const char EOL = '\n'; void solve(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(numeric_limits<double>::max_digits10); solve(); return 0; } multiset<ll> prime_factorization(ll n) { multiset<ll> m; ll x = n; ll d = 2; while (x > 1 && d * d <= n) { if (x % d == 0) { m.emplace(d); x /= d; } else { d++; } } if (x != 1) m.emplace(x); return m; } void solve() { int q; cin >> q; while (q--) { ll a; cin >> a; if (a == 1) { cout << 0 << EOL; continue; } multiset<ll> p = prime_factorization(a); cout << sz(p) << " "; for (auto q : p) cout << q << ' '; } cout << EOL; }