Submission #1107149

# Submission time Handle Problem Language Result Execution time Memory
1107149 2024-10-31T17:57:16 Z toast12 Savrsen (COCI17_savrsen) C++14
120 / 120
523 ms 78708 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    vector<long long> sum(b+1);
    for (int i = 2; i <= b; i++) {
        for (int j = i+i; j <= b; j += i) sum[j] += i;
        sum[i]++;
    }
    long long ans = 0;
    for (int i = a; i <= b; i++) ans += abs(i-sum[i]);
    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 2 ms 1104 KB Output is correct
4 Correct 499 ms 78524 KB Output is correct
5 Correct 523 ms 78708 KB Output is correct
6 Correct 497 ms 78672 KB Output is correct
7 Correct 449 ms 72444 KB Output is correct
8 Correct 49 ms 20304 KB Output is correct