#include <bits/stdc++.h>
#define F first
#define S second
#define V vector
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << "LINE(" << __LINE__ << "): " << #x << " is " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;
const int INF = 1e9 + 7, N = 2e3 + 7, M = 1e9 + 7;
int dp[N][N], ans[N];
void add(int& a, int b) {
a += b;
if(a >= M) a -= M;
}
signed main()
{
ios::sync_with_stdio(0), cin.tie(0);
dp[0][0] = 1;
for(int i = 0; i <= 2000; i++)
for(int j = 0; i + j <= 2000; j++) {
// add 0
if(i + j + 1 <= 2000) add(dp[i + j + 1][j], dp[i][j]);
// add 1
if(i + j + 1 <= 2000) add(dp[i][i + j + 1], dp[i][j]);
add(ans[i + j], dp[i][j]);
}
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int k;
cin >> k;
cout << ans[k] << '\n';
cout << -1 << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
30 ms |
15984 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
16044 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
30 ms |
15960 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |