Submission #471555

# Submission time Handle Problem Language Result Execution time Memory
471555 2021-09-09T18:32:04 Z rainboy Sažetak (COCI17_sazetak) C
64 / 160
24 ms 10260 KB
#include <stdio.h>

#define N	5000000

int main() {
	static char marked[N];
	int n, m, i, k, ans;

	scanf("%d%d", &n, &m);
	while (m--) {
		scanf("%d", &k);
		for (i = k; i < n; i += k)
			marked[i] = 1;
	}
	ans = 0;
	for (i = 0; i < n; i++)
		if (marked[i] && (i + 1 == n || marked[i + 1]))
			ans++;
	printf("%d\n", ans);
	return 0;
}

Compilation message

sazetak.c: In function 'main':
sazetak.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d%d", &n, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~
sazetak.c:11:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d", &k);
      |   ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 8 ms 4300 KB Output is correct
4 Correct 24 ms 4892 KB Output is correct
5 Runtime error 7 ms 10156 KB Execution killed with signal 11
6 Runtime error 8 ms 10188 KB Execution killed with signal 11
7 Runtime error 9 ms 10260 KB Execution killed with signal 11
8 Runtime error 8 ms 10228 KB Execution killed with signal 11
9 Runtime error 8 ms 10188 KB Execution killed with signal 11
10 Runtime error 8 ms 10224 KB Execution killed with signal 11