# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
159933 | mdn2002 | Mobitel (COCI19_mobitel) | C++14 | 359 ms | 1144 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;
int mod=1e9+7;
int r,c,n,a[303][303],dp[303][303];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>r>>c>>n;
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
cin>>a[i][j];
}
}
dp[0][min(a[0][0],n)]=1;
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
if(i==0&&j==0)continue;
for(int z=n;z>=0;z--)
{
if(dp[j][z])
{
int x=z*a[i][j];
dp[j][min(x,n)]=dp[j][z];
dp[j][min(x,n)]%=mod;
}
}
for(int z=n;z>=0;z--)
{
if(dp[j-1][z])
{
int x=z*a[i][j];
dp[j][min(x,n)]+=dp[j-1][z];
dp[j][min(x,n)]%=mod;
}
}
}
}
cout<<dp[c-1][n];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |