# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49342 | 2018-05-26T09:21:15 Z | 3zp | Kangaroo (CEOI16_kangaroo) | C++14 | 1832 ms | 425624 KB |
#include<bits/stdc++.h> using namespace std; int dp[209][209][209][3]; int prefdp[209][209][209][3]; int mod = 1e9+ 7; main(){ int n,l,r; cin >> n >> l >> r; dp[1][1][1][1] = 1; dp[1][1][1][0] = 1; prefdp[1][1][1][1] = 1; prefdp[1][1][1][0] = 1; for(int N = 2; N <= n; N++){ for(int L = 1; L <= n; L++){ for(int R = max(0,r - (n - N)); R <= r; R++){ for(int D = 0; D < 2; D++){ if(L != R){ int nR = R; if (R > L) nR--; if(D == 0){ dp[N][L][R][D] += prefdp[N-1][N-1][nR][1-D] - prefdp[N-1][L-1][nR][1-D] + mod; while (dp[N][L][R][D] > mod) dp[N][L][R][D]-=mod; } else { dp[N][L][R][D] += prefdp[N-1][L-1][nR][1-D]; while (dp[N][L][R][D] > mod) dp[N][L][R][D]-=mod; } } prefdp[N][L][R][D] = prefdp[N][L-1][R][D] + dp[N][L][R][D]; if( prefdp[N][L][R][D] > mod) prefdp[N][L][R][D] -= mod; } } } } cout << (dp[n][l][r][0] + dp[n][l][r][1]) % mod << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 612 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 612 KB | Output is correct |
3 | Correct | 5 ms | 3720 KB | Output is correct |
4 | Correct | 10 ms | 8376 KB | Output is correct |
5 | Correct | 9 ms | 8376 KB | Output is correct |
6 | Correct | 10 ms | 8376 KB | Output is correct |
7 | Correct | 9 ms | 8376 KB | Output is correct |
8 | Correct | 10 ms | 8376 KB | Output is correct |
9 | Correct | 30 ms | 8376 KB | Output is correct |
10 | Correct | 10 ms | 8376 KB | Output is correct |
11 | Correct | 9 ms | 8376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 612 KB | Output is correct |
3 | Correct | 5 ms | 3720 KB | Output is correct |
4 | Correct | 10 ms | 8376 KB | Output is correct |
5 | Correct | 9 ms | 8376 KB | Output is correct |
6 | Correct | 10 ms | 8376 KB | Output is correct |
7 | Correct | 9 ms | 8376 KB | Output is correct |
8 | Correct | 10 ms | 8376 KB | Output is correct |
9 | Correct | 30 ms | 8376 KB | Output is correct |
10 | Correct | 10 ms | 8376 KB | Output is correct |
11 | Correct | 9 ms | 8376 KB | Output is correct |
12 | Correct | 246 ms | 194744 KB | Output is correct |
13 | Correct | 192 ms | 194744 KB | Output is correct |
14 | Correct | 221 ms | 195040 KB | Output is correct |
15 | Correct | 256 ms | 196992 KB | Output is correct |
16 | Correct | 193 ms | 196992 KB | Output is correct |
17 | Correct | 245 ms | 196992 KB | Output is correct |
18 | Correct | 183 ms | 196992 KB | Output is correct |
19 | Correct | 254 ms | 196992 KB | Output is correct |
20 | Correct | 261 ms | 197000 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 612 KB | Output is correct |
3 | Correct | 5 ms | 3720 KB | Output is correct |
4 | Correct | 10 ms | 8376 KB | Output is correct |
5 | Correct | 9 ms | 8376 KB | Output is correct |
6 | Correct | 10 ms | 8376 KB | Output is correct |
7 | Correct | 9 ms | 8376 KB | Output is correct |
8 | Correct | 10 ms | 8376 KB | Output is correct |
9 | Correct | 30 ms | 8376 KB | Output is correct |
10 | Correct | 10 ms | 8376 KB | Output is correct |
11 | Correct | 9 ms | 8376 KB | Output is correct |
12 | Correct | 246 ms | 194744 KB | Output is correct |
13 | Correct | 192 ms | 194744 KB | Output is correct |
14 | Correct | 221 ms | 195040 KB | Output is correct |
15 | Correct | 256 ms | 196992 KB | Output is correct |
16 | Correct | 193 ms | 196992 KB | Output is correct |
17 | Correct | 245 ms | 196992 KB | Output is correct |
18 | Correct | 183 ms | 196992 KB | Output is correct |
19 | Correct | 254 ms | 196992 KB | Output is correct |
20 | Correct | 261 ms | 197000 KB | Output is correct |
21 | Runtime error | 1832 ms | 425624 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
22 | Halted | 0 ms | 0 KB | - |