Submission #382019

# Submission time Handle Problem Language Result Execution time Memory
382019 2021-03-26T09:43:36 Z Vimmer Vepar (COCI21_vepar) C++14
0 / 70
94 ms 78572 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("unroll-loops")

#define N 100500
#define NN 10000005
#define PB push_back
#define M ll(1e9 + 7)
#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;

ll mlt(ll x, ll y)
{
    return (x * y) % M;
}

ll binpow(ll a, ll b)
{
    if (b == 0) return 1;

    ll s = binpow(a, b / 2);

    s = mlt(s, s);

    if (b % 2)
        s = mlt(s, a);

    return s;
}

ll f[NN];

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

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

    f[0] = 1;

    for (int i = 1; i < NN; i++)
        f[i] = mlt(f[i - 1], i);

    int q;

    cin >> q;

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

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

        ll r = mlt(f[d], binpow(f[c - 1], M - 2));

        ll l = mlt(f[b], binpow(f[a - 1], M - 2));

        ll x = mlt(f[d], f[a - 1]);

        ll y = mlt(f[b], f[c - 1]);

        x /= y;
//        y = binpow(y, M - 2);
//
//        x = mlt(x, y);

        if (mlt(l, x) == r)
        {
            pri("DA");
        }
        else
        {
            pri("NE");
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 93 ms 78572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 92 ms 78572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 92 ms 78572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 94 ms 78572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 93 ms 78572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 92 ms 78572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 93 ms 78572 KB Output isn't correct
2 Halted 0 ms 0 KB -