#include<bits/stdc++.h>
using namespace std;
int mod=1e9+7;
long long r,c,n,a[353][353],dp[353][353],dp1[353][353];
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--)
{
long long x=z*a[i][j];
dp[j][min(x,n)]=dp1[j][z]+dp[j-1][z];
dp[j][min(x,n)]%=mod;
}
}
for(int j=0;j<c;j++)
{
for(int z=0;z<=n;z++)dp1[j][z]=dp[j][z];
}
}
cout<<dp[c-1][n];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
348 ms |
2936 KB |
Output isn't correct |
2 |
Incorrect |
378 ms |
2936 KB |
Output isn't correct |
3 |
Runtime error |
4 ms |
1144 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
4 ms |
1148 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
4 ms |
1144 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
4 ms |
1016 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
3 ms |
888 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
7 ms |
1784 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
10 ms |
2296 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
13 ms |
2296 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |