# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
109145 | bibabas | Savrsen (COCI17_savrsen) | C++14 | 1949 ms | 39672 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.
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
int INF = (int)2e9;
using namespace std;
template <class T>
istream& operator >>(istream &in, vector<T> &arr) {
for (T &cnt : arr) {
in >> cnt;
}
return in;
};
int sum[(int)1e7 + 1];
void solve() {
sum[1] = 1;
int a, b; cin >> a >> b;
ll ans = 0;
for (int i = 1; i <= (int)1e7; ++i){
if (a <= i && i <= b)
ans += abs(sum[i] - i);
for (int j = 2 * i; j <= (int)1e7; j += i){
sum[j] += i;
}
}
cout << ans;
}
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#endif
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |