Submission #371033

# Submission time Handle Problem Language Result Execution time Memory
371033 2021-02-25T16:01:07 Z FatihSolak Savrsen (COCI17_savrsen) C++17
120 / 120
1335 ms 39660 KB
#include <bits/stdc++.h>
#define N 10000005
using namespace std;
int arr[N];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int a,b;
	cin >> a >> b;
	long long sum = 0;
	for(int i=1;i<N;i++){
		for(int j=i+i;j<N;j+=i){
			arr[j] -= i;
		}
		arr[i]+=i;
	}
	for(int i=a;i<=b;i++){
		sum += abs(arr[i]);
	}
	cout << sum;
}

# Verdict Execution time Memory Grader output
1 Correct 1309 ms 39536 KB Output is correct
2 Correct 1294 ms 39532 KB Output is correct
3 Correct 1335 ms 39660 KB Output is correct
4 Correct 1310 ms 39536 KB Output is correct
5 Correct 1321 ms 39536 KB Output is correct
6 Correct 1325 ms 39532 KB Output is correct
7 Correct 1321 ms 39536 KB Output is correct
8 Correct 1318 ms 39660 KB Output is correct