답안 #241443

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
241443 2020-06-24T08:02:35 Z NONAME Sažetak (COCI17_sazetak) C++14
64 / 160
24 ms 5120 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 11 ms 4352 KB Output is correct
4 Correct 24 ms 5120 KB Output is correct
5 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)