이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int dp[305][305][305];
const int MOD = 1e9 + 7;
int rek(int at, int open, int closed){
if(at == 0){
if(closed == 0){
return 1;
}
return 0;
}
if(dp[at][open][closed] != -1){
return dp[at][open][closed];
}
int ret = 0;
ret += rek(at - 1, open + 2, closed + 1);
if(open > 0){
ret += rek(at - 1, open - 1, max(closed - 2, 0));
}
return dp[at][open][closed] = ret % MOD;
}
int n;
int main()
{
ios_base::sync_with_stdio(false);
int t_case;
cin >> t_case;
int t;
cin >> t;
memset(dp, -1, sizeof dp);
while(t --){
cin >> n;
cout << rek(n, 0, 0) << endl;
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |