Submission #884450

# Submission time Handle Problem Language Result Execution time Memory
884450 2023-12-07T11:39:31 Z lalig777 Savrsen (COCI17_savrsen) C++14
120 / 120
773 ms 78928 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;


int main(){
	int a, b;
	cin>>a>>b;
	const int N=1e7+1;
	long long int sum=0;
	if (a==1) sum++;
	vector<long long int>sum_mult(N, 1);
	for (int i=2; i<=b; ++i) {
		for (int j=2*i; j<N; j+=i) sum_mult[j]+=i;
		if (a<=i) sum+=abs(i-sum_mult[i]);
	}cout<<sum<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 125 ms 78704 KB Output is correct
2 Correct 331 ms 78696 KB Output is correct
3 Correct 606 ms 78700 KB Output is correct
4 Correct 773 ms 78700 KB Output is correct
5 Correct 738 ms 78928 KB Output is correct
6 Correct 731 ms 78704 KB Output is correct
7 Correct 725 ms 78696 KB Output is correct
8 Correct 728 ms 78680 KB Output is correct