MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / f

Function f

CSES/DP/GridPaths.cpp:28–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26ostream &operator<<(ostream &ostream, const vector<T> &c) { for (auto &it : c) { cout << it << " "; } return ostream; }
27
28int f(int i,int k,vector<vector<char>> &grid,vector<vector<int>> &dp) {
29 if (i < 0 || k < 0 ) return 0;
30 if (i == 0 && k == 0 && grid[i][k] != '*') return 1;
31
32 if (grid[i][k] == '*') return 0;
33 if (dp[i][k] != -1) return dp[i][k];
34 int one = f(i-1,k,grid,dp) % mod;
35 int second = f(i,k-1,grid,dp) % mod;
36 return (dp[i][k] = (one + second) %mod) %= mod;
37}
38
39void solve() {
40 int N; cin >> N;

Callers 1

solveFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected