| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 236159 | VEGAnn | Sažetak (COCI17_sazetak) | C++14 | 31 ms | 19832 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define a3 array<int, 3>
using namespace std;
const int oo = 2e9;
const int M = 20;
#ifdef _LOCAL
const int N = int(1.5e8);
#else
const int N = int(5e6) + 10;
#endif
bitset<N> mrk;
int nt[N], n, m, a[M], ans = 0, extend[M];
bool ok(int lf, int rt, int x){
    for (int i = 0; i < m; i++){
        int rit = rt;
        if (rt == n)
            rit = extend[i];
        int bd = (x / a[i]) * a[i];
        if (lf > bd && rit >= bd + a[i])
            return 1;
    }
    return 0;
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL
    cin >> n >> m;
    mrk[n] = 1;
    for (int i = 0; i < m; i++){
        cin >> a[i];
        for (int j = a[i]; j <= n; j += a[i])
            mrk[j] = 1;
        if (n % a[i] > 0)
            extend[i] = n + (a[i] - n % a[i]);
        else extend[i] = n;
    }
    for (int i = n; i > 1; i--) {
        nt[i] = nt[i + 1];
        if (mrk[i] && mrk[i - 1]){
            ans++;
            nt[i]++;
        } else nt[i] = 0;
    }
//    int lst = 0;
//
//    for (int i = 1; i <= n; i++)
//        if (nt[i] > 0){
//            lst++;
//        } else {
//            int lf = i - lst;
//            int rt = i + nt[i + 1];
//
//            if (ok(lf, rt, i)){
//                ans++;
//                lst++;
//            } else lst = 0;
//        }
    cout << ans;
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
