Submission #37659

# Submission time Handle Problem Language Result Execution time Memory
37659 2017-12-26T17:00:11 Z szawinis Sažetak (COCI17_sazetak) C++14
32 / 160
0 ms 2992 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+1;

int n, m, ans;
bool mark[N];
int main() {
	scanf("%d %d", &n, &m);
	for(int i = 0, k; i < m; i++) {
		scanf("%d", &k);
		for(int j = k; j <= n; j += k) mark[j] = true;
	}
	mark[0] = mark[n] = true;
	for(int i = 1; i <= n; i++) ans += mark[i] && mark[i-1];
	printf("%d", ans);
}

Compilation message

sazetak.cpp: In function 'int main()':
sazetak.cpp:8:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
                        ^
sazetak.cpp:10:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &k);
                  ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2992 KB Output is correct
2 Correct 0 ms 2992 KB Output is correct
3 Runtime error 0 ms 2992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 0 ms 2992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 0 ms 2992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 0 ms 2992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 0 ms 2992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 0 ms 2992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 0 ms 2992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 0 ms 2992 KB Execution killed with signal 11 (could be triggered by violating memory limits)