# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100371 | Runtime_error_ | Mobitel (COCI19_mobitel) | C++11 | 84 ms | 66560 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>
using namespace std;
const int inf=3e2+9,mod=1e9+7;
int a[inf][inf],n,m,k,dp[inf][inf][inf],Pas[inf+inf][inf+inf];
int solve(int i,int j,int sum){
if( i>n || j>m)
return 0;
if(i==n && j==m)
return (sum>=k);
int &ret=dp[i][j][sum];
if(ret!=-1)
return ret;
ret=0;
ret=((long long )ret+solve(i+1,j,min(k,sum*a[i+1][j]) ) )%mod;
ret=((long long )ret+solve(i,j+1,min(sum*a[i][j+1],k)))%mod;
return ret;
}
int main(){
cin>>n>>m>>k;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cin>>a[i][j];
memset(dp,-1,sizeof(dp));
cout<<solve(1,1,a[1][1])<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |