Submission #122870


Source Code Expand

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

#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define FOR(it,o)  for(__typeof((o).begin()) it=(o).begin(); it!=(o).end(); ++it)
#define dbg(x) cout << __LINE__ << ' ' << #x << " = " << (x) << endl


typedef long long ll;

using namespace std;

//ハマったらチェックリスト見ろ!!

const int N = 30;
// (basho) * (left) * (right) * (top) * bottom

//重複組合せの総数
//a[i]個あるn種類のものからm個選ぶときの組み合わせの数

ll MOD = 1000000007;


ll comb[N*N+1][N*N+1];

void makeComb(){
  rep(i, N*N+1)rep(j, N*N+1)comb[i][j] = 0;
  rep(i, N*N+1){
    comb[i][0] = 1;
  }
  REP(i, 1, N*N+1){
    REP(j, 1, N*N+1){
      comb[i][j] = (comb[i-1][j-1] + comb[i-1][j])%MOD;
    }
  }
}

ll solve1(ll space, ll d, ll l){
  if(min(d, l) < 0)return 0;
  ll ret = comb[space][d+l];
  ret *= comb[d+l][l];
  ret %=MOD;
  return ret;
}


int main(){
  int R, C;
  makeComb();
  while(cin >> R >> C){

    int X, Y, D, L;
    cin >> X >> Y;
    cin >> D >> L;
    swap(X, Y);
    if(X == 1 && Y == 1){
      if(D + L == 1){
	cout << 1 << endl;
      }
      else cout << 0 <<endl;
      continue;
    }
    // y, x, 

    ll ans = 0;
    rep(x1, C){
      rep(y1, R){
	int x2 = x1 + X-1;
	int y2 = y1 + Y -1;
	if(x2 >= C || y2 >= R)continue;
	rep(d, 3){
	  rep(l, 3){
	    if(d + l != 2)continue;
	    if(d == l){
	      ans += 2*solve1(X*Y-2, D-d, L-l);
	    }else{
	      ans += solve1(X*Y-2, D-d, L-l);
	    }
	    ans %= MOD;
	  }
	}
      }
    }
    cout << ans <<endl;
  }
  return 0;
}

Submission Info

Submission Time
Task D - AtCoder社の冬
User shioshiota
Language C++ (G++ 4.6.4)
Score 0
Code Size 2066 Byte
Status WA
Exec Time 45 ms
Memory 7200 KB

Judge Result

Set Name sub All
Score / Max Score 0 / 100 0 / 1
Status
AC × 24
WA × 1
AC × 31
WA × 21
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 43 ms 7084 KB
00_sample_02E.txt AC 43 ms 7092 KB
00_sample_03E.txt AC 43 ms 7092 KB
00_sample_04.txt WA 41 ms 7084 KB
test_01.txt WA 43 ms 7088 KB
test_02.txt AC 43 ms 7084 KB
test_03E.txt AC 41 ms 7084 KB
test_04E.txt AC 42 ms 7064 KB
test_05.txt AC 43 ms 7084 KB
test_06.txt WA 43 ms 7088 KB
test_07E.txt AC 43 ms 7088 KB
test_08E.txt AC 43 ms 7084 KB
test_09.txt WA 42 ms 7088 KB
test_10.txt WA 42 ms 7084 KB
test_11E.txt AC 45 ms 7064 KB
test_12E.txt AC 42 ms 7084 KB
test_13.txt WA 42 ms 7088 KB
test_14.txt WA 42 ms 7192 KB
test_15E.txt AC 45 ms 7068 KB
test_16E.txt AC 42 ms 7200 KB
test_17.txt WA 42 ms 7084 KB
test_18.txt WA 42 ms 7084 KB
test_19E.txt AC 45 ms 7068 KB
test_20E.txt AC 42 ms 7080 KB
test_21.txt WA 45 ms 7064 KB
test_22.txt WA 42 ms 7088 KB
test_23E.txt AC 43 ms 7076 KB
test_24E.txt AC 43 ms 7076 KB
test_25.txt WA 45 ms 7076 KB
test_26.txt WA 42 ms 7080 KB
test_27E.txt AC 42 ms 7088 KB
test_28E.txt AC 43 ms 7084 KB
test_29.txt WA 44 ms 7080 KB
test_30.txt WA 43 ms 7084 KB
test_31E.txt AC 42 ms 7084 KB
test_32E.txt AC 44 ms 7088 KB
test_33.txt AC 44 ms 7064 KB
test_34.txt WA 43 ms 7084 KB
test_35.txt AC 44 ms 7064 KB
test_36E.txt AC 44 ms 7060 KB
test_37E.txt AC 42 ms 7080 KB
test_38E.txt AC 42 ms 7092 KB
test_39E.txt WA 44 ms 7072 KB
test_40.txt WA 43 ms 7080 KB
test_41.txt AC 42 ms 7076 KB
test_42.txt WA 43 ms 7084 KB
test_43.txt AC 44 ms 7064 KB
test_44.txt WA 42 ms 7088 KB
test_45E.txt AC 44 ms 7068 KB
test_46.txt WA 45 ms 7060 KB
test_47E.txt AC 43 ms 7168 KB
test_48.txt AC 43 ms 7084 KB