Need help

Правка en1, от Mo_Huzaifa, 2022-07-05 20:32:33

problem statement: cses grid paths https://cses.fi/problemset/task/1638/ What is wrong with my code?? code:

include<bits/stdc++.h>

using namespace std;

define ll long long

define INF 999999999999999999

ll N; char s[1005][1005]; ll arr[1005][1005];

ll path(ll i,ll j) { if(s[i][j]=='*') { return 0; } if(i==N&&j==N) { return 1; } if(i>N||j>N) { return 0; } if(arr[i][j]!=-1) { arr[i][j]%=10000007; return arr[i][j]; } ll res1=path(i,j+1); //res1=res1%10000007; ll res2=path(i+1,j); //res2=res2%10000007; arr[i][j]=res1+res2; arr[i][j]%=10000007; return arr[i][j]; }

void solve() { ll i,j,k,m; cin>>N; for(i=1;i<=N;++i) { for(j=1;j<=N;++j) { cin>>s[i][j]; } } memset(arr,-1,sizeof(arr)); cout<<path(1,1)<<endl; return ; }

int main() { ll i,j,k,n,m,t; solve(); return 0; }

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Mo_Huzaifa 2022-07-05 20:38:35 920
en1 Английский Mo_Huzaifa 2022-07-05 20:32:33 1047 Initial revision (published)