Submission #82757

# Submission time Handle Problem Language Result Execution time Memory
82757 2018-11-01T15:00:58 Z heon Savrsen (COCI17_savrsen) C++11
120 / 120
1590 ms 39728 KB
#include<bits/stdc++.h>

using namespace std;

const int MAXN = 1e7 + 5;

int v[MAXN];

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int a,b;
	cin >> a >> b;
	for(int i = 1; i <= b; i++){
		for(int j = i + i; j <= b; j += i){
			v[j] += i;
		}
	}
	long long sum = 0;
	for(int i = a; i <= b; i++){
		sum += abs(i - v[i]); 
		//cout << abs(i - v[i]) << " ";
	}
	cout << sum;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 5 ms 972 KB Output is correct
4 Correct 1590 ms 39684 KB Output is correct
5 Correct 1495 ms 39712 KB Output is correct
6 Correct 1416 ms 39728 KB Output is correct
7 Correct 1195 ms 39728 KB Output is correct
8 Correct 150 ms 39728 KB Output is correct