Submission #172808

#TimeUsernameProblemLanguageResultExecution timeMemory
172808AkashiTents (JOI18_tents)C++14
100 / 100
125 ms35672 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int n, m; int d[3005][3005]; int main() { // freopen("1.in", "r", stdin); scanf("%d%d", &n, &m); d[0][n] = 1; for(int c = 1; c <= m ; ++c){ for(int l = 0; l <= n ; ++l){ d[c][l] = d[c - 1][l]; d[c][l] = (d[c][l] + 4LL * (l + 1) * d[c - 1][l + 1]) % MOD; d[c][l] = (d[c][l] + 1LL * (1LL * (l + 2) * (l + 1) / 2) % MOD * d[c - 1][l + 2]) % MOD; if(c > 1) d[c][l] = (d[c][l] + (1LL * (m - c + 1) * (l + 1)) % MOD * d[c - 2][l + 1]) % MOD; } } int Sol = -1; for(int l = 0; l <= n ; ++l) Sol = (Sol + d[m][l]) % MOD; printf("%d", Sol); return 0; }

Compilation message (stderr)

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