# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
89898 |
2018-12-18T22:14:03 Z |
xiaowuc1 |
괄호 (kriii4_R) |
C++14 |
|
24 ms |
19320 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1000000007;
ll dp[2000005];
ll solve(int n, int k) {
if(n == 0) return 1;
if(n == 2) return k;
if(dp[n]) return dp[n];
// (s)
ll ret = k*solve(n-2, k);
ret %= MOD;
// ()s()
if(n >= 4) {
ret += k*solve(n-4, k);
ret %= MOD;
}
dp[n] = ret;
return ret;
}
void solve() {
int n, k;
cin >> n >> k;
cout << solve(2*n, k) << "\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
19320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
19320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |