# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
19854 |
2016-02-25T06:19:16 Z |
Qwaz |
동전 (kriii4_E) |
C++ |
|
43 ms |
2232 KB |
#include <iostream>
#include <vector>
using namespace std;
const int mod = 1000000007;
// dp[last][xor]
int dp[256][256] = {0}, ndp[256][256];
inline void add_to(int &a, int b) {
a = (a + b) % mod;
}
int main() {
int n;
cin >> n;
dp[0][0] = 1;
for (int l = 0; l < n; l++) {
for (int i = 0; i <= l + 1; i++)
for (int j = 0; j <= l + 1; j++)
ndp[i][j] = 0;
for (int i = 0; i <= l; i++)
for (int j = 0; j <= l; j++) {
// not flipped
add_to(ndp[i + 1][j ^ i ^ (i + 1)], dp[i][j]);
// flipped
add_to(ndp[0][j], dp[i][j]);
}
for (int i = 0; i <= l + 1; i++)
for (int j = 0; j <= l + 1; j++)
dp[i][j] = ndp[i][j];
}
int sum = 0;
for (int i = 0; i <= n; i++)
add_to(sum, dp[i][0]);
cout << sum << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2232 KB |
Output is correct |
2 |
Correct |
0 ms |
2232 KB |
Output is correct |
3 |
Correct |
0 ms |
2232 KB |
Output is correct |
4 |
Correct |
0 ms |
2232 KB |
Output is correct |
5 |
Correct |
0 ms |
2232 KB |
Output is correct |
6 |
Correct |
0 ms |
2232 KB |
Output is correct |
7 |
Correct |
0 ms |
2232 KB |
Output is correct |
8 |
Correct |
0 ms |
2232 KB |
Output is correct |
9 |
Correct |
0 ms |
2232 KB |
Output is correct |
10 |
Correct |
0 ms |
2232 KB |
Output is correct |
11 |
Correct |
0 ms |
2232 KB |
Output is correct |
12 |
Correct |
0 ms |
2232 KB |
Output is correct |
13 |
Correct |
0 ms |
2232 KB |
Output is correct |
14 |
Correct |
0 ms |
2232 KB |
Output is correct |
15 |
Correct |
0 ms |
2232 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2232 KB |
Output is correct |
2 |
Correct |
13 ms |
2232 KB |
Output is correct |
3 |
Correct |
0 ms |
2232 KB |
Output is correct |
4 |
Correct |
0 ms |
2232 KB |
Output is correct |
5 |
Correct |
0 ms |
2232 KB |
Output is correct |
6 |
Correct |
0 ms |
2232 KB |
Output is correct |
7 |
Correct |
24 ms |
2232 KB |
Output is correct |
8 |
Correct |
33 ms |
2232 KB |
Output is correct |
9 |
Correct |
6 ms |
2232 KB |
Output is correct |
10 |
Correct |
31 ms |
2232 KB |
Output is correct |
11 |
Correct |
2 ms |
2232 KB |
Output is correct |
12 |
Correct |
2 ms |
2232 KB |
Output is correct |
13 |
Correct |
29 ms |
2232 KB |
Output is correct |
14 |
Correct |
16 ms |
2232 KB |
Output is correct |
15 |
Correct |
6 ms |
2232 KB |
Output is correct |
16 |
Correct |
0 ms |
2232 KB |
Output is correct |
17 |
Correct |
40 ms |
2232 KB |
Output is correct |
18 |
Correct |
0 ms |
2232 KB |
Output is correct |
19 |
Correct |
13 ms |
2232 KB |
Output is correct |
20 |
Correct |
0 ms |
2232 KB |
Output is correct |
21 |
Correct |
21 ms |
2232 KB |
Output is correct |
22 |
Correct |
14 ms |
2232 KB |
Output is correct |
23 |
Correct |
8 ms |
2232 KB |
Output is correct |
24 |
Correct |
4 ms |
2232 KB |
Output is correct |
25 |
Correct |
2 ms |
2232 KB |
Output is correct |
26 |
Correct |
0 ms |
2232 KB |
Output is correct |
27 |
Correct |
28 ms |
2232 KB |
Output is correct |
28 |
Correct |
0 ms |
2232 KB |
Output is correct |
29 |
Correct |
28 ms |
2232 KB |
Output is correct |
30 |
Correct |
43 ms |
2232 KB |
Output is correct |