Submission #57139

#TimeUsernameProblemLanguageResultExecution timeMemory
57139kriiiTents (JOI18_tents)C++17
100 / 100
142 ms71716 KiB
#include <stdio.h> const long long mod = 1000000007; long long d[3030][3030]; int main() { int N,M; scanf ("%d %d",&N,&M); for (int i=0;i<=N;i++) for (int j=0;j<=M;j++){ if (i == 0 || j == 0) d[i][j] = 1; else{ d[i][j] = (d[i-1][j] + d[i-1][j-1] * j * 4) % mod; if (i >= 2) d[i][j] = (d[i][j] + d[i-2][j-1] * (i - 1) * j) % mod; if (j >= 2) d[i][j] = (d[i][j] + d[i-1][j-2] * j * (j - 1) / 2) % mod; } } printf ("%lld\n",(d[N][M]+mod-1)%mod); return 0; }

Compilation message (stderr)

tents.cpp: In function 'int main()':
tents.cpp:8: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...