Submission #381916

#TimeUsernameProblemLanguageResultExecution timeMemory
381916NONAMEVepar (COCI21_vepar)C++17
0 / 70
81 ms39532 KiB
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); template <typename T> inline bool chmin(T& a, const T b) {a = min(a, b); return (a == b);} template <typename T> inline bool chmax(T& a, const T b) {a = max(a, b); return (a == b);} const int base = (int)(1e9 + 7); const int man = (int)(1e7 + 10); int fact[man]; inline void cls() {} int mul(int x, int y) { return (x * 1LL * y) % base; } int bp(int x, int y) { int ret = 1; while (y) { if (y & 1) { ret = mul(ret, x); } x = mul(x, x); y >>= 1; } return ret; } void solve() { cls(); int a, b, c, d; cin >> a >> b >> c >> d; int r1 = mul(fact[b], bp(fact[a - 1], base - 2)); int r2 = mul(fact[d], bp(fact[c - 1], base - 2)); if ((r2 % r1) == 0) { cout << "DA\n"; } else { cout << "NE\n"; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // int t = 1; #ifdef _LOCAL system("color a"); freopen("in.txt", "r", stdin); // cin >> t; #endif fact[0] = 1; for (int i = 1; i <= 1e7; ++i) { fact[i] = mul(fact[i - 1], i); } int t; cin >> t; while (t--) { solve(); } // for (int i = 1; i <= t; ++i) { // cerr << "Case #" << i << ": \n"; // solve(); // cerr << "\n"; // } return 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...