Submission #338091

# Submission time Handle Problem Language Result Execution time Memory
338091 2020-12-22T13:10:53 Z juggernaut Energetic turtle (IZhO11_turtle) C++14
40 / 100
2000 ms 262148 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[2005][2005][21],mod,a[2005][2005];
int n,m,k,t;
int main(){
    scanf("%d%d%d%d%lld",&n,&m,&k,&t,&mod);
    while(k--){
        int x,y;
        scanf("%d%d",&x,&y);
        a[x+1][y+1]=1;
    }
    dp[1][0][0]=1;
    for(int i=1;i<=n+1;i++)
        for(int j=1;j<=m+1;j++)
            if(a[i][j])for(int l=1;l<=t;l++)dp[i][j][l]=(dp[i-1][j][l-1]+dp[i][j-1][l-1])%mod;
            else for(int l=0;l<=t;l++)dp[i][j][l]=(dp[i-1][j][l]+dp[i][j-1][l])%mod;
    ll res=0;
    for(int i=0;i<=t;i++)res=(res+dp[n+1][m+1][i])%mod;
    printf("%lld",res);
}

Compilation message

turtle.cpp: In function 'int main()':
turtle.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%d%d%d%d%lld",&n,&m,&k,&t,&mod);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
turtle.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |         scanf("%d%d",&x,&y);
      |         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 876 KB Output is correct
4 Correct 2 ms 1516 KB Output is correct
5 Correct 6 ms 5996 KB Output is correct
6 Correct 29 ms 43884 KB Output is correct
7 Correct 57 ms 69944 KB Output is correct
8 Correct 113 ms 169324 KB Output is correct
9 Runtime error 301 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 518 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
11 Execution timed out 2085 ms 112876 KB Time limit exceeded
12 Execution timed out 2077 ms 84120 KB Time limit exceeded
13 Execution timed out 2057 ms 142816 KB Time limit exceeded
14 Execution timed out 2090 ms 119788 KB Time limit exceeded
15 Execution timed out 2090 ms 76464 KB Time limit exceeded
16 Execution timed out 2085 ms 146228 KB Time limit exceeded
17 Execution timed out 2088 ms 227040 KB Time limit exceeded
18 Execution timed out 2094 ms 117100 KB Time limit exceeded
19 Execution timed out 2090 ms 95960 KB Time limit exceeded
20 Execution timed out 2040 ms 71316 KB Time limit exceeded