Submission #129460

#TimeUsernameProblemLanguageResultExecution timeMemory
129460dndhkTents (JOI18_tents)C++14
100 / 100
98 ms70872 KiB
#include <bits/stdc++.h>

#define pb push_back
#define all(v) ((v).begin(), (v).end())
#define sortv(v) sort(all(v))
#define sz(v) ((int)(v).size())
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define umax(a, b) (a)=max((a), (b))
#define umin(a, b) (a)=min((a), (b))
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define rep(i,n) FOR(i,1,n)
#define rep0(i,n) FOR(i,0,(int)(n)-1)
#define FI first
#define SE second
#define INF 2000000000
#define INFLL 1000000000000000000LL


using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll DIV = 1000000007;
const int MAX_N = 3000;

int H, W;
ll DP[MAX_N+1][MAX_N+1];

int main(){
	scanf("%d%d", &H, &W);
	for(int i=0; i<=W; i++){
		DP[0][i] = 1;
	}
	for(int i=1; i<=H; i++){
		DP[i][0] = 1;
		for(int j=1; j<=W; j++){
			DP[i][j] = (DP[i-1][j] + DP[i-1][j-1] * (ll)(4 * j) + (i>=2 ? DP[i-2][j-1] : 0)* (ll)j * (ll)(i-1) + (j>=2 ? DP[i-1][j-2] : 0) * (ll)j * (ll)(j-1) / 2 ) %DIV;
			//cout<<i<<" "<<j<<" "<<DP[i][j]<<endl;
		}
	}
	cout<<(DP[H][W] + DIV - 1)%DIV;
	return 0;
}

Compilation message (stderr)

tents.cpp: In function 'int main()':
tents.cpp:31:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &H, &W);
  ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...