# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1133777 | lopkus | Savrsen (COCI17_savrsen) | C++20 | 1032 ms | 78664 KiB |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 5;
vector<long long> D(N, 0);
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
for(int i = 1; i < N; i++) {
for(int j = i; j < N; j+= i) {
D[j] += i;
}
}
for(int i = 1; i < N; i++) {
D[i] = D[i - 1] + abs((D[i] - i) - i);
}
int l, r;
cin >> l >> r;
cout << D[r] - D[l - 1];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |