Submission #488649

# Submission time Handle Problem Language Result Execution time Memory
488649 2021-11-19T21:34:32 Z JovanB Savrsen (COCI17_savrsen) C++17
120 / 120
1092 ms 78576 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;

const int N = 10000000;

ll dp[N+5];

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int a, b;
    cin >> a >> b;
    for(int i=1; i<=b; i++) for(int j=2*i; j<=b; j+=i) dp[j] += i;
    ll res = 0;
    for(int i=a; i<=b; i++) res += abs(dp[i] - i);
    cout << res << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 2 ms 1100 KB Output is correct
4 Correct 1092 ms 78572 KB Output is correct
5 Correct 1066 ms 78572 KB Output is correct
6 Correct 1092 ms 78576 KB Output is correct
7 Correct 981 ms 72420 KB Output is correct
8 Correct 208 ms 20232 KB Output is correct