Submission #960883

#TimeUsernameProblemLanguageResultExecution timeMemory
960883Ice_manTents (JOI18_tents)C++14
100 / 100
41 ms71016 KiB
/** ____ ____ ____ __________________ ____ ____ ____ ||I || ||c || ||e || || || ||M || ||a || ||n || ||__|| ||__|| ||__|| ||________________|| ||__|| ||__|| ||__|| |/__\| |/__\| |/__\| |/________________\| |/__\| |/__\| |/__\| */ #include <iostream> #include <chrono> //#include <vector> #define maxn 3005 #define maxlog 20 #define INF 1000000010 #define mod 1000000007 #define LINF 1000000000000000005 #define endl '\n' #define pb(x) push_back(x) #define X first #define Y second #define control cerr<<"passed"<<endl; ///#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math") ///#pragma GCC target("avx2") using namespace std; std::chrono::high_resolution_clock::time_point startT, currT; constexpr double TIME_MULT = 1; double timePassed() { using namespace std::chrono; currT = high_resolution_clock::now(); double time = duration_cast<duration<double>>(currT - startT).count(); return time * TIME_MULT; } long long dp[maxn][maxn]; int n, m; void read() { cin >> n >> m; } void calc_dp() { for(int i = 0; i <= max(n , m); i++) { dp[i][0] = 1; dp[0][i] = 1; } for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) { dp[i][j] += dp[i - 1][j]; dp[i][j] += dp[i - 1][j - 1] * j * 4LL; if(j > 1) dp[i][j] += dp[i - 1][j - 2] * (j - 1) * j / 2LL; if(i > 1) dp[i][j] += j * (i - 1) * dp[i - 2][j - 1]; dp[i][j] %= mod; } cout << (dp[n][m] + mod - 1) % mod << endl; } int main() { /**#ifdef ONLINE_JUDGE /// promeni freopen("taxi.in", "r", stdin); freopen("taxi.out", "w", stdout); #endif*/ ios_base::sync_with_stdio(false); cin.tie(nullptr); //startT = std::chrono::high_resolution_clock::now(); read(); calc_dp(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...