# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
564293 |
2022-05-18T21:28:40 Z |
faruk |
Savrsen (COCI17_savrsen) |
C++17 |
|
825 ms |
39468 KB |
#include <bits/stdc++.h>
#define pii pair<int, int>
#define ll long long
#define ld long double
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int b, a;
cin >> a >> b;
vector<int> sito(b + 1, 0);
sito[1] = 1;
for (int i = 2; i <= b; i++) {
if (sito[i] != 0)
continue;
sito[i] = i + 1;
for (int j = i * 2; j <= b; j += i) {
int t = 0;
int s = j;
while (s % i == 0)
s /= i, t++;
if (sito[j / i] == 0 || sito[s] == 0)
continue;
sito[j] = sito[j / i] + sito[s] * (j / s);
}
}
ll out = 0;
for (int i = a; i <= b; i++)
out += abs(i - (sito[i] - i));
cout << out << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
8 ms |
724 KB |
Output is correct |
4 |
Correct |
825 ms |
39380 KB |
Output is correct |
5 |
Correct |
819 ms |
39468 KB |
Output is correct |
6 |
Correct |
811 ms |
39464 KB |
Output is correct |
7 |
Correct |
749 ms |
36308 KB |
Output is correct |
8 |
Correct |
208 ms |
10324 KB |
Output is correct |