CSES - Orac & LCM

Author: Benjamin Qi

Table of Contents

Solution
Edit on Github

Official Editorial

Solution

For each prime, the second-to-lowest exponent of the prime that occurs in any of the numbers in the input is the exponent of this prime that will appear in the final answer. Interestingly, we can do this without explicitly computing the prime factorizations.

ll a,b;
int n;
void red() {
ll g = __gcd(a,b);
tie(a,b) = mp(g,a/g*b);
}
int main() {
setIO(); re(n);

Give Us Feedback on CSES - Orac & LCM!