Submission #487605

# Submission time Handle Problem Language Result Execution time Memory
487605 2021-11-16T09:30:33 Z KazamaHoang Savrsen (COCI17_savrsen) C++14
120 / 120
1052 ms 78664 KB
#include <bits/stdc++.h>

using namespace std;

int a, b;
long long sumDiv[10000005];

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> a >> b;
    for (int i = 1; i <= 1e7; ++ i)
        for (int j = i + i; j <= 1e7; j += i)
            sumDiv[j] += i;
    long long res = 0;
    for (int i = a; i <= b; ++ i) {
        res += abs(sumDiv[i] - i);
    }
    cout << res;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1008 ms 78580 KB Output is correct
2 Correct 1018 ms 78664 KB Output is correct
3 Correct 1010 ms 78576 KB Output is correct
4 Correct 1052 ms 78576 KB Output is correct
5 Correct 1046 ms 78664 KB Output is correct
6 Correct 1033 ms 78576 KB Output is correct
7 Correct 1026 ms 78576 KB Output is correct
8 Correct 1014 ms 78640 KB Output is correct