# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337561 | 2020-12-21T05:28:54 Z | beksultan04 | Energetic turtle (IZhO11_turtle) | C++14 | 2000 ms | 155464 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 = 3e5+12,INF=1e9+7; int dp[4][N][21]; vector <int> v[N]; 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) v[x].pb(y); } 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] += dp[i%3][j][l]; dp[(i+1)%3][j][l] = dp[i%3][j][l]; dp[i%3][j+1][l] %= mod; dp[(i+1)%3][j][l] %= 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 | 5 ms | 7404 KB | Output is correct |
2 | Incorrect | 5 ms | 7424 KB | Output isn't correct |
3 | Correct | 5 ms | 7404 KB | Output is correct |
4 | Correct | 5 ms | 7404 KB | Output is correct |
5 | Correct | 11 ms | 7424 KB | Output is correct |
6 | Incorrect | 24 ms | 7660 KB | Output isn't correct |
7 | Correct | 60 ms | 7788 KB | Output is correct |
8 | Correct | 89 ms | 7916 KB | Output is correct |
9 | Execution timed out | 2073 ms | 9836 KB | Time limit exceeded |
10 | Execution timed out | 2093 ms | 12268 KB | Time limit exceeded |
11 | Execution timed out | 2094 ms | 56684 KB | Time limit exceeded |
12 | Execution timed out | 2104 ms | 155372 KB | Time limit exceeded |
13 | Execution timed out | 2070 ms | 155464 KB | Time limit exceeded |
14 | Execution timed out | 2067 ms | 56684 KB | Time limit exceeded |
15 | Execution timed out | 2098 ms | 56684 KB | Time limit exceeded |
16 | Execution timed out | 2094 ms | 145004 KB | Time limit exceeded |
17 | Execution timed out | 2092 ms | 130668 KB | Time limit exceeded |
18 | Execution timed out | 2104 ms | 155372 KB | Time limit exceeded |
19 | Execution timed out | 2102 ms | 155372 KB | Time limit exceeded |
20 | Execution timed out | 2097 ms | 155372 KB | Time limit exceeded |