Submission #159931

# Submission time Handle Problem Language Result Execution time Memory
159931 2019-10-25T13:01:03 Z mdn2002 Mobitel (COCI19_mobitel) C++14
0 / 130
308 ms 1272 KB
#include<bits/stdc++.h>
using namespace std;
int r,c,n,a[303][303],dp[303][303];
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--)
            {
                if(dp[j][z])
                {
                    int x=z*a[i][j];
                    dp[j][min(x,n)]=dp[j][z];
                }
            }
            for(int z=n;z>=0;z--)
            {
                if(dp[j-1][z])
                {
                    int x=z*a[i][j];
                    dp[j][min(x,n)]+=dp[j-1][z];
                }
            }
        }
    }
    cout<<dp[c-1][n];
}
# Verdict Execution time Memory Grader output
1 Incorrect 286 ms 1016 KB Output isn't correct
2 Incorrect 308 ms 1148 KB Output isn't correct
3 Runtime error 3 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 3 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 3 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 3 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 7 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 9 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 10 ms 1144 KB Execution killed with signal 11 (could be triggered by violating memory limits)