답안 #381986

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381986 2021-03-26T08:32:29 Z Vimmer Vepar (COCI21_vepar) C++14
30 / 70
228 ms 239596 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define N 100500
#define NN 10000005
#define PB push_back
#define endl '\n'
#define pri(x) cout << x << endl
#define _ << " " <<
#define sz(x) int(x.size())
#define F first
#define S second
#define all(x) x.begin(), x.end()

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

//typedef tree <int, null_type, less_equal <int>, rb_tree_tag, tree_order_statistics_node_update> ord_set;

vector <int> vr[NN];

int mk[NN], kol[NN], id;

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

//    freopen("1.in", "r", stdin);

    for (int i = 2; i < N; i++)
    {
        if (sz(vr[i]) != 0) continue;

        for (int j = i; j < N; j += i)
            {
                int x = j;

                while (x % i == 0)
                {
                    vr[j].PB(i);

                    x /= i;
                }
            }
    }

    int q;

    cin >> q;

    for (; q > 0; q--)
    {
        int a, b, c, d;

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

        if (c <= a && b <= d)
        {
            pri("DA");

            continue;
        }

//        if (c <= b && a <= c)
//        {
//            int l = c;
//
//            c = b + 1;
//
//            b = c - 1;
//        }
//
//        if (a <= d && d <= b)
//        {
//            int l = d;
//
//            d = a - 1;
//
//            a = l + 1;
//        }

        id++;

        for (int i = c; i <= d; i++)
            for (auto it : vr[i])
            {
                if (mk[it] != id)
                {
                    mk[it] = id;

                    kol[it] = 0;
                }

                kol[it]++;
            }

        bool gd = 1;

        for (int i = a; i <= b && gd; i++)
            for (auto it : vr[i])
            {
                if (mk[it] != id)
                {
                    gd = 0;

                    break;
                }

                kol[it]--;

                if (kol[it] == -1)
                {
                    gd = 0;

                    break;
                }
            }

        if (gd)
        {
            pri("DA");
        }
        else
        {
            pri("NE");
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 188 ms 238976 KB Output is correct
2 Correct 161 ms 238688 KB Output is correct
3 Correct 163 ms 238680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 238828 KB Output is correct
2 Correct 167 ms 238664 KB Output is correct
3 Correct 166 ms 238828 KB Output is correct
4 Correct 168 ms 238700 KB Output is correct
5 Correct 173 ms 238828 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 238700 KB Output is correct
2 Correct 168 ms 238828 KB Output is correct
3 Correct 168 ms 238700 KB Output is correct
4 Correct 170 ms 238828 KB Output is correct
5 Correct 165 ms 238728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 190 ms 238700 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 228 ms 239516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 217 ms 239596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 225 ms 239596 KB Output isn't correct
2 Halted 0 ms 0 KB -