답안 #37660

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
37660 2017-12-26T17:00:49 Z szawinis Sažetak (COCI17_sazetak) C++14
64 / 160
19 ms 6896 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 5e6+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);
                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 6896 KB Output is correct
2 Correct 0 ms 6896 KB Output is correct
3 Correct 6 ms 6896 KB Output is correct
4 Correct 19 ms 6896 KB Output is correct
5 Runtime error 0 ms 6896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 0 ms 6896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 3 ms 6896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 0 ms 6896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 3 ms 6896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 6896 KB Execution killed with signal 11 (could be triggered by violating memory limits)