Submission #317350

# Submission time Handle Problem Language Result Execution time Memory
317350 2020-10-29T15:11:50 Z jjj Savrsen (COCI17_savrsen) C++14
120 / 120
1614 ms 78712 KB
#include <bits/stdc++.h>

using namespace std;

long long s1[10000010];

int main()
{
	int a, b;
	
	cin >> a >> b;
	
	long long s = 0;
	
	for(int i = 1; i <= b; i++)
	{
		int x;
		
		if(a % i == 0) x = a;
		else x = (a / i + 1) * i;
		
		for( ; x <= b; x += i) 
			if(x != i) 
				s1[x] += i;
	}	
		
	for(int i = a; i <= b; i++)
		s += abs(s1[i] - i);
		
	cout << s;
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 3 ms 1152 KB Output is correct
4 Correct 55 ms 380 KB Output is correct
5 Correct 1462 ms 70832 KB Output is correct
6 Correct 1614 ms 78712 KB Output is correct
7 Correct 1442 ms 71384 KB Output is correct
8 Correct 333 ms 20344 KB Output is correct