Submission #7579102
Source Code Expand
#include"bits/stdc++.h" using namespace std; #define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++) #define rep(i,n) REP((i),0,(n)) using ll = long long; struct ModInt { static const ll MOD = 1000000007; // constructors etc ModInt() :num(1ll) {} ModInt(ll num_) :num(num_) {} ModInt(const ModInt& modint) :num(modint.num) {} ll get()const { return num; } // operator etc // operator ll() const { return num; } // ll operator*() { return num; } ModInt& operator+=(const ModInt& r) { (num += r.num) %= MOD; return *this; } ModInt& operator-=(const ModInt& r) { (num += -r.num + MOD) %= MOD; return *this; } ModInt& operator*=(const ModInt& r) { (num *= r.num) %= MOD; return *this; } ModInt& operator/=(const ModInt& r) { (num *= r.inv().num) %= MOD; return *this; } ModInt pow(const ModInt& r)const { ll res = 1; ll x = num; ll n = r.num; while (n > 0) { if (n & 1)res = (res*x) % MOD; x = (x*x) % MOD; n >>= 1; } return res; } ModInt inv()const { return this->pow(MOD - 2); } ModInt operator+(const ModInt& r)const { return ModInt(*this) += r; } ModInt operator-(const ModInt& r)const { return ModInt(*this) -= r; } ModInt operator*(const ModInt& r)const { return ModInt(*this) *= r; } ModInt operator/(const ModInt& r)const { return ModInt(*this) /= r; } ModInt operator+(const ll& r)const { return *this + ModInt(r); } ModInt operator-(const ll& r)const { return *this - ModInt(r); } ModInt operator*(const ll& r)const { return *this * ModInt(r); } ModInt operator/(const ll& r)const { return *this / ModInt(r); } private: ll num; }; ostream& operator<<(ostream& stream, const ModInt& val) { stream << val.get(); return stream; } struct Comb { static constexpr ll LIM = 200000; static vector<ModInt> fact, inv; static void init() { fact.resize(LIM, 1); inv.resize(LIM, 1); REP(i, 1, LIM)fact[i] = fact[i - 1] * i; inv[LIM - 1] = fact[LIM - 1].inv(); for (ll i = LIM - 2; i > 0; i--)inv[i] = inv[i + 1] * (i + 1); } static ModInt comb(ll n, ll k) { if (n < k)return 0ll; return fact[n] * inv[k] * inv[n - k]; } }; vector<ModInt> Comb::fact; vector<ModInt> Comb::inv; int main() { ll R, C, X, Y, D, L; cin >> R >> C >> X >> Y >> D >> L; R -= X - 1; C -= Y - 1; Comb::init(); cout << Comb::comb(D + L, D)*R*C << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - AtCoder社の冬 |
User | toma25 |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 2393 Byte |
Status | WA |
Exec Time | 5 ms |
Memory | 3328 KB |
Judge Result
Set Name | sub | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 100 / 100 | 0 / 1 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
sub | 00_sample_01E.txt, 00_sample_02E.txt, 00_sample_03E.txt, test_03E.txt, test_04E.txt, test_07E.txt, test_08E.txt, test_11E.txt, test_12E.txt, test_15E.txt, test_16E.txt, test_19E.txt, test_20E.txt, test_23E.txt, test_24E.txt, test_27E.txt, test_28E.txt, test_31E.txt, test_32E.txt, test_36E.txt, test_37E.txt, test_38E.txt, test_39E.txt, test_45E.txt, test_47E.txt |
All | 00_sample_01E.txt, 00_sample_02E.txt, 00_sample_03E.txt, 00_sample_04.txt, test_01.txt, test_02.txt, test_03E.txt, test_04E.txt, test_05.txt, test_06.txt, test_07E.txt, test_08E.txt, test_09.txt, test_10.txt, test_11E.txt, test_12E.txt, test_13.txt, test_14.txt, test_15E.txt, test_16E.txt, test_17.txt, test_18.txt, test_19E.txt, test_20E.txt, test_21.txt, test_22.txt, test_23E.txt, test_24E.txt, test_25.txt, test_26.txt, test_27E.txt, test_28E.txt, test_29.txt, test_30.txt, test_31E.txt, test_32E.txt, test_33.txt, test_34.txt, test_35.txt, test_36E.txt, test_37E.txt, test_38E.txt, test_39E.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45E.txt, test_46.txt, test_47E.txt, test_48.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01E.txt | AC | 5 ms | 3328 KB |
00_sample_02E.txt | AC | 5 ms | 3328 KB |
00_sample_03E.txt | AC | 5 ms | 3328 KB |
00_sample_04.txt | WA | 5 ms | 3328 KB |
test_01.txt | WA | 5 ms | 3328 KB |
test_02.txt | WA | 5 ms | 3328 KB |
test_03E.txt | AC | 5 ms | 3328 KB |
test_04E.txt | AC | 5 ms | 3328 KB |
test_05.txt | WA | 5 ms | 3328 KB |
test_06.txt | WA | 5 ms | 3328 KB |
test_07E.txt | AC | 5 ms | 3328 KB |
test_08E.txt | AC | 5 ms | 3328 KB |
test_09.txt | WA | 5 ms | 3328 KB |
test_10.txt | WA | 5 ms | 3328 KB |
test_11E.txt | AC | 5 ms | 3328 KB |
test_12E.txt | AC | 5 ms | 3328 KB |
test_13.txt | WA | 5 ms | 3328 KB |
test_14.txt | WA | 5 ms | 3328 KB |
test_15E.txt | AC | 5 ms | 3328 KB |
test_16E.txt | AC | 5 ms | 3328 KB |
test_17.txt | WA | 5 ms | 3328 KB |
test_18.txt | WA | 5 ms | 3328 KB |
test_19E.txt | AC | 5 ms | 3328 KB |
test_20E.txt | AC | 5 ms | 3328 KB |
test_21.txt | WA | 5 ms | 3328 KB |
test_22.txt | WA | 5 ms | 3328 KB |
test_23E.txt | AC | 5 ms | 3328 KB |
test_24E.txt | AC | 5 ms | 3328 KB |
test_25.txt | WA | 5 ms | 3328 KB |
test_26.txt | WA | 5 ms | 3328 KB |
test_27E.txt | AC | 5 ms | 3328 KB |
test_28E.txt | AC | 5 ms | 3328 KB |
test_29.txt | WA | 5 ms | 3328 KB |
test_30.txt | WA | 5 ms | 3328 KB |
test_31E.txt | AC | 5 ms | 3328 KB |
test_32E.txt | AC | 5 ms | 3328 KB |
test_33.txt | WA | 5 ms | 3328 KB |
test_34.txt | WA | 5 ms | 3328 KB |
test_35.txt | WA | 5 ms | 3328 KB |
test_36E.txt | AC | 5 ms | 3328 KB |
test_37E.txt | AC | 5 ms | 3328 KB |
test_38E.txt | AC | 5 ms | 3328 KB |
test_39E.txt | AC | 5 ms | 3328 KB |
test_40.txt | WA | 5 ms | 3328 KB |
test_41.txt | WA | 5 ms | 3328 KB |
test_42.txt | WA | 5 ms | 3328 KB |
test_43.txt | WA | 5 ms | 3328 KB |
test_44.txt | WA | 5 ms | 3328 KB |
test_45E.txt | AC | 5 ms | 3328 KB |
test_46.txt | WA | 5 ms | 3328 KB |
test_47E.txt | AC | 5 ms | 3328 KB |
test_48.txt | WA | 5 ms | 3328 KB |