제출 #241443

#제출 시각아이디문제언어결과실행 시간메모리
241443NONAMESažetak (COCI17_sazetak)C++14
64 / 160
24 ms5120 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

bool mk[5 * int(1e6) + 10];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #ifdef _LOCAL
        freopen("in", "r", stdin);
        freopen("out", "w", stdout);
    #endif // _LOCAL

    int n, m;

    cin >> n >> m;
    mk[n] = 1;
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x;

        for (int j = x; j <= n; j += x)
            mk[j] = 1;
    }

    int ans = 0;

    for (int i = 1; i < n; ++i)
        ans += (mk[i] && mk[i + 1]);

    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...