# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37660 | szawinis | Sažetak (COCI17_sazetak) | C++14 | 19 ms | 6896 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |