Contest Duration: ~ (local time) (120 minutes) Back to Home

Submission #123096

Source Code Expand

Copy
```#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <string>
#include <sstream>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define repn(i, n) for(int i = 1; i <= (int)n; ++i)
#define pb push_back
#define lb lower_bound
#define mp make_pair
#define ite iterator
#define max2(x, y) (((x) > (y)) ? (x) : (y))
#define max3(x,y,z) max2((x), max2((y),(z)))
#define max4(v,w,x,y) max2(max2((v),(w)), max2((x),(y)))
#define min2(x, y) (((x) > (y)) ? (y) : (x))
#define min3(x,y,z) min2((x), min2((y),(z)))
#define min4(v,w,x,y) min2(min2((v),(w)), min2((x),(y)))
#define ul unsigned long
#define ull unsigned long long
#define INF 1000000007
#define MOD 1000000007
#define fs first
#define sd second

template<typename T>
bool elem(set<T> st, T val){
return (st.find(val) != st.end());
}

template<typename T>
void printv(vector<T> vt){
if(vt.size() == 0) return;
rep(i, vt.size() - 1)
cout << vt[i] << " ";
cout << vt[vt.size() - 1] << endl;
}

#define CNUM 901
ull ctable[CNUM][CNUM];

typedef vector<int> vint;
typedef vector<ul> vul;
typedef vector<ull> vull;
typedef pair<int, int> pii;

ull dp[31][31];
int r, c, x, y, d, l;

ull dpf(int ax, int ay){
if(dp[ax][ay] < MOD) return dp[ax][ay];
ull p = (r - ax + 1)*(c - ay + 1);
int n = ax * ay;
ull ans = 1;
ans *= ctable[n][d];
ans %= MOD;
ans *= ctable[n - d][l];
ans %= MOD;
ans *= p;
ans %= MOD;
for(int i = 1; i <= ax; ++i){
for(int j = 1; j <= ay; ++j){
if(i == ax && j == ay) continue;
if(i*j >= d + l){
if(ans < dpf(i,j)) ans += MOD;
ans -= dpf(i, j);
}
}
}
return (dp[ax][ay] = ans);
}

int main(void){
rep(i, 31) rep(j, 31) dp[i][j] = MOD;
for(int i = 0; i < CNUM; ++i){
for(int j = 0; j <= i; ++j){
if(i == 0 || j == 0 || i == j)
ctable[i][j] = 1;
else
ctable[i][j] = (ctable[i - 1][j - 1] + ctable[i - 1][j]) % MOD;
}
}
cin >>r >> c >> x >> y >> d >> l;
cout << dpf(x, y) << endl;
return 0;
}```

#### Submission Info

Submission Time 2013-12-12 22:53:19+0900 D - AtCoder社の冬 numa C++ (G++ 4.6.4) 100 2370 Byte WA 35 ms 6680 KB

#### Judge Result

Set Name sub All
Score / Max Score 100 / 100 0 / 1
Status
 AC × 25
 AC × 27 WA × 25
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 31 ms 6436 KB
00_sample_02E.txt 31 ms 6436 KB
00_sample_03E.txt 31 ms 6440 KB
00_sample_04.txt 31 ms 6440 KB
test_01.txt 30 ms 6516 KB
test_02.txt 31 ms 6448 KB
test_03E.txt 30 ms 6424 KB
test_04E.txt 31 ms 6436 KB
test_05.txt 31 ms 6496 KB
test_06.txt 32 ms 6496 KB
test_07E.txt 31 ms 6428 KB
test_08E.txt 31 ms 6560 KB
test_09.txt 31 ms 6440 KB
test_10.txt 32 ms 6440 KB
test_11E.txt 30 ms 6436 KB
test_12E.txt 31 ms 6560 KB
test_13.txt 31 ms 6436 KB
test_14.txt 31 ms 6560 KB
test_15E.txt 30 ms 6680 KB
test_16E.txt 31 ms 6436 KB
test_17.txt 30 ms 6520 KB
test_18.txt 31 ms 6440 KB
test_19E.txt 30 ms 6492 KB
test_20E.txt 30 ms 6556 KB
test_21.txt 34 ms 6508 KB
test_22.txt 32 ms 6520 KB
test_23E.txt 32 ms 6520 KB
test_24E.txt 35 ms 6440 KB
test_25.txt 31 ms 6568 KB
test_26.txt 31 ms 6564 KB
test_27E.txt 31 ms 6440 KB
test_28E.txt 30 ms 6440 KB
test_29.txt 32 ms 6440 KB
test_30.txt 32 ms 6436 KB
test_31E.txt 29 ms 6428 KB
test_32E.txt 32 ms 6444 KB
test_33.txt 31 ms 6564 KB
test_34.txt 32 ms 6444 KB
test_35.txt 31 ms 6436 KB
test_36E.txt 31 ms 6440 KB
test_37E.txt 29 ms 6436 KB
test_38E.txt 29 ms 6564 KB
test_39E.txt 31 ms 6564 KB
test_40.txt 31 ms 6436 KB
test_41.txt 31 ms 6484 KB
test_42.txt 30 ms 6444 KB
test_43.txt 30 ms 6440 KB
test_44.txt 31 ms 6436 KB
test_45E.txt 31 ms 6520 KB
test_46.txt 33 ms 6436 KB
test_47E.txt 32 ms 6500 KB
test_48.txt 31 ms 6440 KB