답안 #86374

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86374 2018-11-26T08:22:18 Z dimash241 Savrsen (COCI17_savrsen) C++17
45 / 120
13 ms 8844 KB
#include <iostream>

using namespace std;

int f[1010101];
int a, b;

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

	long long ans = 0;
	for (int i = a; i <= b; ++i)
		ans += abs(f[i] - i);

	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 5 ms 784 KB Output is correct
4 Runtime error 11 ms 8540 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 11 ms 8780 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 13 ms 8780 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 12 ms 8804 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 11 ms 8844 KB Execution killed with signal 11 (could be triggered by violating memory limits)