제출 #1346203

#제출 시각아이디문제언어결과실행 시간메모리
1346203Faisal_SaqibMobitel (COCI19_mobitel)C++20
52 / 130
5123 ms131072 KiB
#include <iostream>
#include <map>
using namespace std;
//#define int long long
const int N=302,mod=1e9+7;
int a[N][N];
map<int,int> cnt[N];
map<int,int> cnp[N];
int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int r,s,n;
	cin>>r>>s>>n;
	for(int i=1;i<=r;i++)
	{
		for(int j=1;j<=s;j++)
		{
			cin>>a[i][j];
		}
	}
	cnt[1][a[1][1]]++;
	for(int i=1;i<=r;i++)
	{
		for(int j=1;j<=s;j++)
		{
			for(auto&[w,c]:cnt[j-1])
			{
				if(1ll*w*a[i][j]>=n)
				{
					(cnt[j][n]+=c)%=mod;
				}
				else
				{
					(cnt[j][w*a[i][j]]+=c)%=mod;
				}
			}
			for(auto&[w,c]:cnp[j])
			{
				if(1ll*w*a[i][j]>=n)
				{
					(cnt[j][n]+=c)%=mod;
				}
				else
				{
					(cnt[j][w*a[i][j]]+=c)%=mod;
				}
			}
			cnp[j].clear();
		}
		for(int j=1;j<=s;j++)
		{
			swap(cnp[j],cnt[j]);
		}
	}
	cout<<cnp[s][n]<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...