Submission #123025


Source Code Expand

Copy
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <climits>
#include <sstream>
#include <functional>
#include <complex>

using namespace std;

#define len(array)  (sizeof (array) / sizeof *(array))
#define rep(i, s, e) for(int i = s;i < e;i++)
#define Rep(i, e) for(int i = 0;i < e;i++)
#define rrep(i, e, s) for(int i = e;s <= i;i--)
#define Rrep(i, e) for(int i = e;0 <= i;i--)
#define vrange(v) v.begin(), v.end()
#define vrrange(v) v.rbegin(), v.rend()
#define vsort(v) sort(vrange(v))
#define vrsort(v) sort(vrrange(v))
#define arange(a) a, a + len(a)
#define asort(a) sort(arange(a))
#define arsort(a, t) sort(arange(a), greater<t>())
#define afill(a, v) fill(arange(a), v)
#define afill2(a, v, t) fill((t *)a, (t *)(a + len(a)), v)
#define fmax(a, b) (a < b? b : a)
#define fmin(a, b) (a > b? b : a)
#define fabs(a) (a < 0? -a : a)
#define pb push_back
#define rg(i, s, t) s <= i && i < t
//#define X real()
//#define Y imag()
//typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
//typedef complex<double> p;
const int INF = (int)2e9;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-10;
//const int dx[] = {1, -1, 0, 0, 1, -1, -1, 1};
//const int dy[] = {0, 0, 1, -1, -1, -1, 1, 1};
//const int weight[] = {0,1,10,100,1000,10000,100000,1000000,10000000};
//priority_queue< int, vector<int>, greater<int> > q;
#define MAX_N 1000

// a x + b y = gcd(a, b)
int extgcd(int a, int b, int &x, int &y) {
  int g = a; x = 1; y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}

// 1/a mod m
int mod_inverse(int a, int m){
  int x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}

//n! mod m
int fact(int n, int m){
  ll ret = 1;
  rep(i, 2, n+1) ret = (ret * i) % m;
  return (int)ret;
}

void doIt(){
  int r, c, x, y, d, l;
  ll ans = 1;
  cin >> r >> c >> x >> y >> d >> l;
  ans = fact(d + l, MOD);
  ans = ans * mod_inverse(fact(d, MOD), MOD) % MOD;
  ans = ans * mod_inverse(fact(l, MOD), MOD) % MOD;
  ans = ans * (r - x + 1) % MOD;
  ans = ans * (c - y + 1) % MOD;
  cout << ans << endl;
}

int main() {
  doIt();
  return 0;
}

Submission Info

Submission Time
Task D - AtCoder社の冬
User mkiken
Language C++ (G++ 4.6.4)
Score 100
Code Size 2371 Byte
Status WA
Exec Time 24 ms
Memory 928 KB

Judge Result

Set Name sub All
Score / Max Score 100 / 100 0 / 1
Status
AC × 25
AC × 25
WA × 27
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 21 ms 808 KB
00_sample_02E.txt AC 22 ms 804 KB
00_sample_03E.txt AC 22 ms 800 KB
00_sample_04.txt WA 21 ms 676 KB
test_01.txt WA 24 ms 780 KB
test_02.txt WA 21 ms 676 KB
test_03E.txt AC 20 ms 800 KB
test_04E.txt AC 21 ms 676 KB
test_05.txt WA 19 ms 928 KB
test_06.txt WA 20 ms 748 KB
test_07E.txt AC 21 ms 680 KB
test_08E.txt AC 20 ms 800 KB
test_09.txt WA 20 ms 800 KB
test_10.txt WA 22 ms 804 KB
test_11E.txt AC 21 ms 804 KB
test_12E.txt AC 21 ms 708 KB
test_13.txt WA 20 ms 924 KB
test_14.txt WA 22 ms 808 KB
test_15E.txt AC 23 ms 776 KB
test_16E.txt AC 21 ms 804 KB
test_17.txt WA 21 ms 800 KB
test_18.txt WA 22 ms 680 KB
test_19E.txt AC 20 ms 676 KB
test_20E.txt AC 20 ms 800 KB
test_21.txt WA 22 ms 740 KB
test_22.txt WA 21 ms 680 KB
test_23E.txt AC 20 ms 800 KB
test_24E.txt AC 21 ms 800 KB
test_25.txt WA 21 ms 760 KB
test_26.txt WA 22 ms 736 KB
test_27E.txt AC 20 ms 800 KB
test_28E.txt AC 22 ms 808 KB
test_29.txt WA 20 ms 808 KB
test_30.txt WA 20 ms 676 KB
test_31E.txt AC 21 ms 680 KB
test_32E.txt AC 21 ms 796 KB
test_33.txt WA 22 ms 732 KB
test_34.txt WA 20 ms 800 KB
test_35.txt WA 20 ms 800 KB
test_36E.txt AC 22 ms 796 KB
test_37E.txt AC 23 ms 804 KB
test_38E.txt AC 21 ms 672 KB
test_39E.txt AC 21 ms 928 KB
test_40.txt WA 21 ms 800 KB
test_41.txt WA 21 ms 800 KB
test_42.txt WA 22 ms 680 KB
test_43.txt WA 20 ms 928 KB
test_44.txt WA 24 ms 804 KB
test_45E.txt AC 20 ms 672 KB
test_46.txt WA 22 ms 724 KB
test_47E.txt AC 21 ms 800 KB
test_48.txt WA 20 ms 800 KB