Submission #947518

# Submission time Handle Problem Language Result Execution time Memory
947518 2024-03-16T10:31:24 Z Blagoj Savrsen (COCI17_savrsen) C++17
120 / 120
934 ms 78712 KB
#include <bits/stdc++.h>

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,unroll-loops")

using namespace std;

#define endl '\n'
#define ll long long
#define all(x) (x).begin(), (x).end()

const int mxn = 1e7 + 10;

ll dp[mxn];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a, b;
    cin >> a >> b;
    ll ans = 0;
    for (int i = 1; i <= b; i++) 
        for (int j = i + i; j <= b; j += i) dp[j] += i;
    for (int i = a; i <= b; i++) ans += abs(i - dp[i]);
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 1116 KB Output is correct
4 Correct 934 ms 78712 KB Output is correct
5 Correct 904 ms 78708 KB Output is correct
6 Correct 911 ms 78704 KB Output is correct
7 Correct 921 ms 72556 KB Output is correct
8 Correct 163 ms 20340 KB Output is correct