# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
159815 | theknife2001 | Mobitel (COCI19_mobitel) | C++17 | 70 ms | 65540 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=355;
const int mod=1e9+7;
int dp[N][N][N];
int a[N][N];
int n,m,M;
int bt(int i , int j, ll val)
{
if(i==n-1&&j==m-1)
{
if(val*a[i][j]>=M)
return 1LL;
return 0LL;
}
if(val>M)
val=M;
int &ret=dp[i][j][val];
if(ret!=-1)
return ret;
ret=0;
if(i+1<n)
ret+=bt(i+1,j,val*a[i][j]);
if(j+1<m)
ret+=bt(i,j+1,val*a[i][j]);
ret%=mod;
return ret;
}
int main()
{
memset(dp,-1,sizeof dp);
ios::sync_with_stdio(false);
cin>>n>>m>>M;
if(M>300)
assert(0);
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
cin>>a[i][j];
}
cout<<bt(0,0,1)<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |