답안 #237757

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
237757 2020-06-08T16:07:25 Z sahil_k Tents (JOI18_tents) C++14
0 / 100
4 ms 384 KB
#include <iostream>
#define MOD 1000000007
using namespace std;
long long dp_ind[3001][3001];
long long dp_ttl[3001][3001];
long long dp_se[3001][3001];
long long col[3001];
int main () {
	int n, m;
	cin >> n >> m;
	long long row;
	for (int i=1; i<=n; i++) {
		row = 0;
		for (int j=1; j<=m; j++) {
			dp_se[i][j] = (dp_ttl[i-1][j-1]+1)%MOD;
			dp_ind[i][j] = (4ll*dp_se[i][j]+row+col[j])%MOD;
			dp_ttl[i][j] = (1ll*dp_ttl[i-1][j]+dp_ttl[i][j-1]-dp_ttl[i-1][j-1]+dp_ind[i][j])%MOD;
			row = (1ll*row+dp_se[i][j])%MOD;
			col[j] = (1ll*col[j]+dp_se[i][j])%MOD;
		}
	}
	cout << dp_ttl[n][m] << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -