# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315043 | 2qbingxuan | Costinland (info1cup19_costinland) | C++14 | 2 ms | 208 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#ifdef local
#define debug(args...) qqbx(#args, args)
template <typename ...T> void qqbx(const char *s, T ...args) {
int cnt = sizeof...(T);
(std::cerr << "(" << s << ") = (" , ... , (std::cerr << args << (--cnt ? ", " : ")\n")));
}
#else
#define debug(...) ((void)0)
#endif // local
#define pb emplace_back
#define all(v) begin(v), end(v)
using namespace std;
using ll = long long;
ll calc(vector<string> v) {
int n = v.size(), m = v[0].size();
vector<vector<array<ll,2>>> dp(n, vector<array<ll,2>>(m));
dp[0][0][0] = 1;
for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) {
if(i == n-1 && j == m-1) continue;
if(v[i][j] == '.') {
dp[i+1][j][0] += dp[i][j][0];
dp[i][j+1][1] += dp[i][j][1];
} else {
ll s = dp[i][j][0] + dp[i][j][1];
if(v[i][j] != 'r')
dp[i+1][j][0] += s;
if(v[i][j] != 'd')
dp[i][j+1][1] += s;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |