Submission #69975

# Submission time Handle Problem Language Result Execution time Memory
69975 2018-08-22T07:32:44 Z khohko parentrises (BOI18_parentrises) C++17
50 / 100
951 ms 5724 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define MAX ((ll)(1e12+100))
#define MX ((ll)(1e6+100))
#define ARRS ((ll)(2e5+100))
#define HS ((ll)(233))
#define MOD ((ll)(1e9+7))
#define EP ((double)(1e-9))
#define LG 21
#define mul(a,b) a=((a)*(b))%MOD
using namespace std;


ll dp[2][405][805];
ll pas[400];
int main(){
	#ifdef KHOKHO
		freopen("in.in","r",stdin);
		freopen("out.out","w",stdout);
	#endif // KHOKHO
	ios::sync_with_stdio(0);
	dp[0][0][400]=1;
	ll N=1,P=0;
	for(int i=0; i<=300; i++){
		pas[i]=0;
		for(int j=0; j<=400; j++)
			for(int k=0; k<=800; k++)
				dp[N][j][k]=0;
		for(int j=0; j<=400; j++){
			for(int k=0; k<=800; k++){
				dp[P][j][k]%=MOD;
				if(k>=1)
				dp[N][j+2][min(399,k-1)]+=dp[P][j][k];
				if(j>=1)
				dp[N][j-1][k+2]+=dp[P][j][k];
				dp[P][j][k]%=MOD;
				//if(dp[P][j][k])
				//cout<<i<<" "<<j<<" "<<k<<" "<<dp[P][j][k]<<endl;
				if(k>=400)
					pas[i]+=dp[P][j][k];
			}
		}
		swap(N,P);
		pas[i]%=MOD;
	}
	ll q,n;
	cin>>q>>q;
	while(q--){
		cin>>n;
		cout<<pas[n]<<endl;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 803 ms 5496 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 951 ms 5616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 951 ms 5616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 951 ms 5616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 726 ms 5616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 726 ms 5616 KB Output is correct
2 Correct 851 ms 5724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 726 ms 5616 KB Output is correct
2 Correct 851 ms 5724 KB Output is correct
3 Correct 879 ms 5724 KB Output is correct