Submission #57035

#TimeUsernameProblemLanguageResultExecution timeMemory
57035cki86201Tents (JOI18_tents)C++11
100 / 100
127 ms72000 KiB
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <memory.h> #include <math.h> #include <assert.h> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <iostream> #include <functional> #include <unordered_map> using namespace std; typedef pair<int, int> Pi; typedef long long ll; #define Fi first #define Se second #define pb(x) push_back(x) #define sz(x) (int)x.size() #define rep(i, n) for(int i=0;i<n;i++) #define all(x) x.begin(), x.end() const int MOD = 1e9 + 7; ll d[3030][3030]; void solve(){ int n, m; scanf("%d%d", &n, &m); rep(i, 3030) d[i][0] = d[0][i] = 1; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { d[i][j] = d[i-1][j] + 4LL * d[i-1][j-1] * j; if(j >= 2) d[i][j] += j * (j-1) / 2 * d[i-1][j-2]; if(i >= 2) d[i][j] += j * (i-1) * d[i-2][j-1]; d[i][j] %= MOD; } } printf("%lld\n", (d[n][m] + MOD - 1) % MOD); } int main(){ int Tc = 1; //scanf("%d", &Tc); for(int tc=1;tc<=Tc;tc++){ solve(); } return 0; }

Compilation message (stderr)

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