# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337562 | 2020-12-21T05:32:52 Z | beksultan04 | Energetic turtle (IZhO11_turtle) | C++14 | 2000 ms | 162540 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]; set <int> s[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) s[x].insert(y); } dp[0][0][t]=1; for (i=0;i<=n;++i){ for (j=0;j<=m;++j){ bool f=0; if (!s[i].empty()){ if (s[i].find(j) != s[i].end())f=1; } for (l=0;l<=t;++l){ dp[i%3][j+1][l-f] += dp[i%3][j][l]; dp[(i+1)%3][j][l-f] = dp[i%3][j][l]; dp[i%3][j+1][l-f] %= mod; dp[(i+1)%3][j][l-f] %= 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 | 9 ms | 14592 KB | Output is correct |
2 | Incorrect | 9 ms | 14444 KB | Output isn't correct |
3 | Incorrect | 9 ms | 14444 KB | Output isn't correct |
4 | Incorrect | 10 ms | 14572 KB | Output isn't correct |
5 | Incorrect | 15 ms | 14444 KB | Output isn't correct |
6 | Incorrect | 28 ms | 14700 KB | Output isn't correct |
7 | Incorrect | 64 ms | 14828 KB | Output isn't correct |
8 | Incorrect | 93 ms | 14956 KB | Output isn't correct |
9 | Execution timed out | 2096 ms | 16876 KB | Time limit exceeded |
10 | Execution timed out | 2095 ms | 19308 KB | Time limit exceeded |
11 | Execution timed out | 2082 ms | 63724 KB | Time limit exceeded |
12 | Execution timed out | 2052 ms | 162412 KB | Time limit exceeded |
13 | Execution timed out | 2076 ms | 162412 KB | Time limit exceeded |
14 | Execution timed out | 2097 ms | 63724 KB | Time limit exceeded |
15 | Execution timed out | 2103 ms | 63724 KB | Time limit exceeded |
16 | Execution timed out | 2025 ms | 152172 KB | Time limit exceeded |
17 | Execution timed out | 2097 ms | 137648 KB | Time limit exceeded |
18 | Execution timed out | 2089 ms | 162412 KB | Time limit exceeded |
19 | Execution timed out | 2085 ms | 162412 KB | Time limit exceeded |
20 | Execution timed out | 2039 ms | 162540 KB | Time limit exceeded |