답안 #159813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
159813 2019-10-24T22:26:47 Z theknife2001 Mobitel (COCI19_mobitel) C++17
0 / 130
61 ms 65540 KB
#include <bits/stdc++.h>
#define ll long long

using namespace std;
const int N=305;
const int mod=1e9+7;
ll dp[N][N][N];
ll a[N][N];
int n,m,M;
ll 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;
	ll &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;
	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;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 61 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 60 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 60 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 60 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 59 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 61 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 58 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 60 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 56 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 56 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)