# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
19797 |
2016-02-25T05:42:38 Z |
rhdmstjr |
괄호 (kriii4_R) |
C++ |
|
4 ms |
8896 KB |
#include <cstdio>
#define MAX_NUM 1000004
#define XXX 1000000007
long long dp[MAX_NUM];
int main(){
int N, K; scanf("%d%d", &N, &K);
// init
dp[0] = 1; // for duplicated one
dp[1] = K;
for(int i = 2; i <= N; i++){
long long &now = dp[i];
long long &pre = dp[i - 1];
now = 0;
// odd
if(i & 1){
}else{
now += dp[i / 2];
}
now %= XXX;
now += pre * K * 2;
//// subtract overlaped part
long long dup = dp[i - 2] * K * K;
dup %= XXX;
now += (XXX - dup);
now %= XXX;
}
printf("%lld\n", dp[N]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
8896 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |