제출 #381896

#제출 시각아이디문제언어결과실행 시간메모리
381896VEGAnnVepar (COCI21_vepar)C++14
0 / 70
1601 ms74868 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MX = int(1e7) + 10;
const int oo = 2e9;
int mn[MX], cnt[MX], now;

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

#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL

    fill(mn, mn + MX, oo);

    for (int i = 2; i < MX; i++){
        if (mn[i] < oo) continue;

        mn[i] = i;

        if (ll(i) * ll(i) > MX) continue;

        for (int j = i * i; j < MX; j += i)
            mn[j] = min(mn[j], i);
    }

    int qq; cin >> qq;

    for (; qq; qq--){
        memset(cnt, sizeof(cnt), 0);

        int a, b, c, d;

        cin >> a >> b >> c >> d;

        for (int i = c; i <= d; i++){
            now = i;

            while (now > 1){
                cnt[mn[now]]++;
                now /= mn[now];
            }
        }

        bool ok = 1;

        for (int i = a; i <= b && ok; i++){
            now = i;

            while (now > 1){
                cnt[mn[now]]--;

                if (cnt[mn[now]] < 0) {
                    ok = 0;
                    break;
                }

                now /= mn[now];
            }
        }

        cout << (ok ? "DA\n" : "NE\n");
    }

    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:31:35: warning: 'memset' used with constant zero length parameter; this could be due to transposed parameters [-Wmemset-transposed-args]
   31 |         memset(cnt, sizeof(cnt), 0);
      |                                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...