# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
456240 |
2021-08-06T09:30:16 Z |
grt |
Zapina (COCI20_zapina) |
C++17 |
|
1 ms |
332 KB |
#include <bits/stdc++.h>
#define ST first
#define ND second
#define PB push_back
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
const int nax = 350 + 10, mod = 1e9 + 7;
int n;
int dp[nax][nax][2];
int bi[nax][nax];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
dp[0][0][0] = 1;
bi[0][0] = 1;
for(int i = 0; i <= n; ++i) {
for(int j = 0; j <= n; ++j) {
if(i == 0) {
bi[i][j] = (i == j);
} else if(j == 0) {
bi[i][j] = 1;
} else {
bi[i][j] = (bi[i - 1][j - 1] + bi[i - 1][j]) % mod;
}
//cout << i << " " << j << ": " << bi[i][j] << "\n";
}
}
for(int i = 1; i <= n; ++i) {
for(int g = 0; g <= n; ++g) {
for(int j = 0; j <= g; ++j) {
dp[i][g][0] = (dp[i][g][0] + (ll)bi[g][j] * dp[i - 1][g - j][0]) % mod;
dp[i][g][1] = (dp[i][g][1] + (ll)bi[g][j] * dp[i - 1][g - j][1]) % mod;
}
if(g >= i) {
dp[i][g][1] = (dp[i][g][1] + (ll)bi[g][i] * dp[i - 1][g - i][0]) % mod;
}
}
}
cout << dp[n][n][1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |