제출 #83454

#제출 시각아이디문제언어결과실행 시간메모리
83454tincamateiTents (JOI18_tents)C++14
100 / 100
141 ms36224 KiB
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 3000;
const int MOD = 1000000007;
int dp[1+MAX_N][1+MAX_N];

int main() {
#ifdef HOME
	FILE *fin = fopen("input.in", "r");
	FILE *fout = fopen("output.out", "w");
#else
	FILE *fin = stdin;
	FILE *fout = stdout;
#endif
	
	int n, m;
	fscanf(fin, "%d%d", &n, &m);
	
	for(int i = 0; i <= MAX_N; ++i)
		dp[0][i] = dp[i][0] = 1;
	
	for(int i = 1; i <= MAX_N; ++i)
		for(int j = 1; j <= MAX_N; ++j) {
			dp[i][j] = ((long long)dp[i - 1][j - 1] * j * 4) % MOD;
			if(i >= 2) dp[i][j] = ((long long)dp[i - 2][j - 1] * (i - 1) * j + dp[i][j]) % MOD;
			if(j >= 2) dp[i][j] = ((long long)dp[i - 1][j - 2] * j * (j - 1) / 2 + dp[i][j]) % MOD;
			dp[i][j] = ((long long)dp[i - 1][j] + dp[i][j]) % MOD;
		}
	
	fprintf(fout, "%d", (dp[n][m] - 1 + MOD) % MOD);

#ifdef HOME
	fclose(fin);
	fclose(fout);
#endif
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

tents.cpp: In function 'int main()':
tents.cpp:19:8: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  fscanf(fin, "%d%d", &n, &m);
  ~~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...