#include <iostream>
using namespace std;
int f[1010101];
int a, b;
int main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> a >> b;
for (int i = 1; i <= b / 2; ++i) {
int j = i + i;
while (j <= b) {
f[j] += i;
j += i;
}
}
long long ans = 0;
for (int i = a; i <= b; ++i)
ans += abs(f[i] - i);
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
5 ms |
784 KB |
Output is correct |
4 |
Runtime error |
11 ms |
8540 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
11 ms |
8780 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
13 ms |
8780 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
12 ms |
8804 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
11 ms |
8844 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |