Submission #1047533

# Submission time Handle Problem Language Result Execution time Memory
1047533 2024-08-07T13:54:32 Z 12345678 Savrsen (COCI17_savrsen) C++17
60 / 120
53 ms 131072 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=1e7+5;

ll a, b, res, p[nx], dp[nx];

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>a>>b;
    for (int i=1; i<=b; i++) dp[i]=1;
    for (ll i=2; i<=b; i++)
    {
        if (p[i]) continue;
        for (ll j=i; j<=b; j+=i)
        {
            p[j]=1;
            ll tmp=1, mul=i;
            while ((j%mul)==0) tmp+=mul, mul*=i;
            dp[j]*=tmp;
        }
    }
    //for (int i=1; i<=b; i++) cout<<"debug "<<dp[i]<<'\n';
    for (int i=a; i<=b; i++) res+=abs(dp[i]-2*i);
    cout<<res;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 3420 KB Output is correct
4 Runtime error 42 ms 131072 KB Execution killed with signal 9
5 Runtime error 42 ms 131072 KB Execution killed with signal 9
6 Runtime error 44 ms 131072 KB Execution killed with signal 9
7 Runtime error 43 ms 131072 KB Execution killed with signal 9
8 Correct 53 ms 41308 KB Output is correct