Submission #23099

# Submission time Handle Problem Language Result Execution time Memory
23099 2017-05-03T05:24:32 Z model_code Savrsen (COCI17_savrsen) C++11
120 / 120
1266 ms 41084 KB
#include <iostream>
#include <vector>
using namespace std;

int abs(int x) { return x > 0 ? x : -x; }

int main() {
    int a, b;
    cin >> a >> b;
    int M = b + 1;
    vector<int> v(M);
    for (int d = 1; d < M; ++d) {
        int dd = d + d;
        while (dd < M) {
            v[dd] += d;
            dd += d;
        }
    }
    long long s = 0;
    for (int i = a; i <= b; ++i)
        s += abs(v[i] - i);
    cout << s << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Correct 3 ms 2420 KB Output is correct
4 Correct 1253 ms 41084 KB Output is correct
5 Correct 1183 ms 41084 KB Output is correct
6 Correct 1266 ms 41084 KB Output is correct
7 Correct 1006 ms 38012 KB Output is correct
8 Correct 129 ms 11952 KB Output is correct