# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1085829 | andrewp | Savrsen (COCI17_savrsen) | C++14 | 595 ms | 78932 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Dedicated to my love, ivaziva
#include <bits/stdc++.h>
using namespace std;
#define int long long
using pii = pair<int, int>;
using ll = int64_t;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define dbg(x) cerr << #x << ": " << x << '\n';
int sum[10000005];
int32_t main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
cout.tie(nullptr); cerr.tie(nullptr);
int a, b;
cin >> a >> b;
for (int i = 2; i < 10000001; i++) {
for (int j = i + i; j < 10000001; j += i) {
sum[j] += i;
}
}
int ans = 0;
for (int i = a; i <= b; i++) {
if (i == 1) {
ans += abs(i - sum[i]);
} else {
ans += abs(i - sum[i] - 1);
}
}
cout << ans << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |