Submission #1091884

# Submission time Handle Problem Language Result Execution time Memory
1091884 2024-09-22T13:08:34 Z plagia Savrsen (COCI17_savrsen) C++14
30 / 120
13 ms 8536 KB
#include <cstdlib>
#include <iostream>

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

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

	for (int i = 2; i * i <= MM; i++) {
		for (int j = i; j < MM; j += i) {
			if (j == i) continue;
			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 12 ms 4184 KB Output is correct
2 Correct 9 ms 4368 KB Output is correct
3 Incorrect 11 ms 4188 KB Output isn't correct
4 Runtime error 11 ms 8280 KB Execution killed with signal 11
5 Runtime error 12 ms 8536 KB Execution killed with signal 11
6 Runtime error 13 ms 8460 KB Execution killed with signal 11
7 Runtime error 13 ms 8536 KB Execution killed with signal 11
8 Runtime error 13 ms 8284 KB Execution killed with signal 11