답안 #100372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100372 2019-03-10T16:16:41 Z Runtime_error_ Mobitel (COCI19_mobitel) C++14
0 / 130
87 ms 66560 KB
#include <bits/stdc++.h>
using namespace std;
const int inf=3e2+9,mod=1e9+7;

int a[inf][inf],n,m,k,dp[inf][inf][inf],Pas[inf+inf][inf+inf];

int solve(int i,int j,int sum){

    if( i>n || j>m)
        return 0;

    if(i==n && j==m)
        return (sum>=k);

    int &ret=dp[i][j][sum];
    if(ret!=-1)
        return ret;

        ret=0;

        ret=((long long )ret+solve(i+1,j,min(k,sum*a[i+1][j]) )  )%mod;

        ret=((long long )ret+solve(i,j+1,min(sum*a[i][j+1],k)))%mod;
        return ret;
}

int main(){

    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            cin>>a[i][j];
    
    assert(k<=300);
    
    memset(dp,-1,sizeof(dp));
    cout<<solve(1,1,a[1][1])<<endl;
}

Compilation message

mobitel.cpp: In function 'int solve(int, int, int)':
mobitel.cpp:16:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if(ret!=-1)
     ^~
mobitel.cpp:19:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
         ret=0;
         ^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 82 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 87 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 7 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 11 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 12 ms 800 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 7 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 7 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 19 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 22 ms 1444 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 26 ms 1544 KB Execution killed with signal 11 (could be triggered by violating memory limits)