Submission #72578

#TimeUsernameProblemLanguageResultExecution timeMemory
72578AbelyanTents (JOI18_tents)C++17
100 / 100
137 ms71364 KiB
#include <iostream> #include <algorithm> #include <vector> #include <cstdio> #include <queue> #include <map> #include <set> #include <cmath> using namespace std; typedef long long ll; const int N = 3006; const ll MOD = 1000000007; ll dp[N][N]; int main() { ios_base::sync_with_stdio(false); int n,m; cin >> n >> m; for (int i = 1; i <= max(n,m); i++) { dp[0][i]=dp[i][0] = 1; dp[1][i]=dp[i][1] = i*(i - 1) / 2 + 4 * i + 1; } for (ll i = 2; i <= n; i++) { for (ll j = 2; j <= m; j++) { dp[i][j] = (i * 4 * dp[i - 1][j - 1] + i*(j - 1)*dp[i - 1][j - 2] + dp[i][j - 1] + (i*(i - 1) / 2) * dp[i - 2][j - 1]) % MOD; } } cout << dp[n][m]-1 << endl; system("pause"); return 0; }

Compilation message (stderr)

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