Submission #80570

# Submission time Handle Problem Language Result Execution time Memory
80570 2018-10-21T12:22:04 Z tpoppo Savrsen (COCI17_savrsen) C++14
120 / 120
2196 ms 79112 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
const ll MAXN = 1e7+1;
ll a,b,res;
ll sumDiv[MAXN];

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin>>a>>b;
	for(int i=1;i<=b;i++){
		for(int j=i;j<=b;j+=i)
			sumDiv[j]+=i;
	}

	for(;a<=b;a++) res += abs(2*a - sumDiv[a]);
	cout<<res;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 7 ms 1232 KB Output is correct
4 Correct 2196 ms 78932 KB Output is correct
5 Correct 2145 ms 79112 KB Output is correct
6 Correct 2167 ms 79112 KB Output is correct
7 Correct 1882 ms 79112 KB Output is correct
8 Correct 262 ms 79112 KB Output is correct