# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
316217 | fcmalkcin | Mobitel (COCI19_mobitel) | C++17 | 1606 ms | 23040 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pll pair<ll,ll>
#define ff first
#define ss second
#define endl "\n"
const ll maxn=1e3+50;
const ll mod =1e9+7;
const ll base=1e17;
ll dp[3][305][maxn][3];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
if (fopen("GIDDY.t", "r"))
{
freopen("GIDDY.inp", "r", stdin);
freopen("GIDDY.out", "w", stdout) ;
}
memset(dp,0,sizeof (dp));
ll n, m, p;
cin>>n>>m >>p ;
dp[0][1][1][0]=1;
ll nw=sqrt(p)+2;
for (int i=1;i<=n;i++)
{
for (int j=1;j<=m;j++)
{
ll val;
cin>>val;
ll now=i%2;
ll pre=1-now;
for (int t=1;t<=nw;t++)
{
ll h=t*val;
if (h<nw)
{
dp[now][j][h][0]=(dp[now][j][h][0]+dp[pre][j][t][0])%mod;
dp[now][j][h][0]=(dp[now][j][h][0]+dp[now][j-1][t][0])%mod;
}
else
{dp[now][j][(p+h-1)/h][1]=(dp[now][j][(p+h-1)/h][1]+dp[pre][j][t][0])%mod;
dp[now][j][(p+h-1)/h][1]=(dp[now][j][(p+h-1)/h][1]+dp[now][j-1][t][0])%mod;
}
}
for (int t=1;t<=nw;t++)
{
dp[now][j][(t+val-1)/val][1]=(dp[now][j][(t+val-1)/val][1]+dp[pre][j][t][1])%mod;
dp[now][j][(t+val-1)/val][1]=(dp[now][j][(t+val-1)/val][1]+dp[now][j-1][t][1])%mod;
}
}
for (int j=1;j<=m;j++)
for (int t=1;t<=nw;t++)
{
dp[1-(i%2)][j][t][0]=0;
dp[1-(i%2)][j][t][1]=0;
}
}
cout <<dp[n%2][m][1][1];
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |