# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
109145 |
2019-05-04T18:20:42 Z |
bibabas |
Savrsen (COCI17_savrsen) |
C++14 |
|
1949 ms |
39672 KB |
#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 |
1 |
Incorrect |
1804 ms |
39512 KB |
Output isn't correct |
2 |
Correct |
1823 ms |
39544 KB |
Output is correct |
3 |
Correct |
1862 ms |
39416 KB |
Output is correct |
4 |
Correct |
1949 ms |
39544 KB |
Output is correct |
5 |
Correct |
1864 ms |
39672 KB |
Output is correct |
6 |
Incorrect |
1839 ms |
39544 KB |
Output isn't correct |
7 |
Correct |
1941 ms |
39544 KB |
Output is correct |
8 |
Correct |
1901 ms |
39544 KB |
Output is correct |