# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337566 | 2020-12-21T06:01:25 Z | beksultan04 | Energetic turtle (IZhO11_turtle) | C++14 | 2000 ms | 71916 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define OK puts("OK"); #define NO puts("NO"); #define YES puts("YES"); #define fr first #define sc second #define ret return #define scan1(a) scanf("%lld",&a); #define scan2(a,b) scanf("%lld %lld",&a, &b); #define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c); #define all(s) s.begin(),s.end() #define allr(s) s.rbegin(),s.rend() #define pb push_back #define sz(v) (int)v.size() #define endi puts(""); const int N = 1e6+12,INF=1e9+7; int dp[2000][2000][30],q[2000][2000]; main(){ int n,m,i,j,k,l,t,mod,ans=0; scan3(n,m,k) scan2(t,mod) while (k--){ int x,y; scan2(x,y) q[x][y]=1; } dp[0][0][t]=1; for (i=0;i<=n;++i){ for (j=0;j<=m;++j){ for (l=0;l<=t;++l){ dp[i%3][j+1][l-q[i][j]] += dp[i%3][j][l]; dp[(i+1)%3][j][l-q[i][j]] += dp[i%3][j][l]; dp[i%3][j+1][l-q[i][j]] %= mod; dp[(i+1)%3][j][l-q[i][j]] %= mod; } } } for (l=0;l<=t;++l){ ans+=dp[n%3][m][l]; ans%=mod; } cout <<ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 1 ms | 372 KB | Output isn't correct |
3 | Incorrect | 1 ms | 364 KB | Output isn't correct |
4 | Incorrect | 1 ms | 364 KB | Output isn't correct |
5 | Incorrect | 7 ms | 492 KB | Output isn't correct |
6 | Incorrect | 21 ms | 748 KB | Output isn't correct |
7 | Incorrect | 57 ms | 748 KB | Output isn't correct |
8 | Incorrect | 87 ms | 1132 KB | Output isn't correct |
9 | Execution timed out | 2086 ms | 5184 KB | Time limit exceeded |
10 | Execution timed out | 2081 ms | 6520 KB | Time limit exceeded |
11 | Execution timed out | 2095 ms | 24940 KB | Time limit exceeded |
12 | Execution timed out | 2099 ms | 71788 KB | Time limit exceeded |
13 | Execution timed out | 2090 ms | 71788 KB | Time limit exceeded |
14 | Execution timed out | 2093 ms | 24940 KB | Time limit exceeded |
15 | Execution timed out | 2089 ms | 24940 KB | Time limit exceeded |
16 | Execution timed out | 2072 ms | 66924 KB | Time limit exceeded |
17 | Execution timed out | 2091 ms | 60416 KB | Time limit exceeded |
18 | Execution timed out | 2044 ms | 71788 KB | Time limit exceeded |
19 | Execution timed out | 2095 ms | 71788 KB | Time limit exceeded |
20 | Execution timed out | 2090 ms | 71916 KB | Time limit exceeded |