Submission #1091889

# Submission time Handle Problem Language Result Execution time Memory
1091889 2024-09-22T13:20:24 Z plagia Savrsen (COCI17_savrsen) C++14
30 / 120
255 ms 39568 KB
#include <cstdlib>
#include <iostream>

const int MM = 1e7 + 10;
int tab[MM]{};

void fill_tab() {
	for (int i = 1; i * i <= MM; i++) {
		for (int j = i * 2; j < MM; j += i) {
			tab[j] += i;	
		}
	}
}

int calculate_imperfection(const int &n) {
	return std::abs(n - tab[n]);
}

int main() {
	std::ios_base::sync_with_stdio(0);

	fill_tab();

	int a, b;
	std::cin >> a >> b;
	
	unsigned long long sum = 0;
	for (int i = a; i <= b; i++) {
		sum += calculate_imperfection(i);
	}

	std::cout << sum << std::endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 241 ms 39512 KB Output is correct
2 Correct 253 ms 39392 KB Output is correct
3 Incorrect 254 ms 39568 KB Output isn't correct
4 Incorrect 247 ms 39512 KB Output isn't correct
5 Incorrect 255 ms 39512 KB Output isn't correct
6 Incorrect 211 ms 39564 KB Output isn't correct
7 Incorrect 232 ms 39512 KB Output isn't correct
8 Incorrect 214 ms 39516 KB Output isn't correct