QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#478500#8483. Count the Christmas Treesrania__#RE 5ms11700kbC++231.0kb2024-07-15 02:54:262024-07-15 02:54:27

Judging History

你现在查看的是最新测评结果

  • [2024-07-15 02:54:27]
  • 评测
  • 测评结果:RE
  • 用时:5ms
  • 内存:11700kb
  • [2024-07-15 02:54:26]
  • 提交

answer

#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef int in;
#define int long long
#define double long double
#define f first
#define s second
#define pb push_back
#define pp push
#define ceill(x,y) ((x/y)+(x%y!=0)*(x/abs(x)*y/abs(y)<0?0:1))
#define floorr(x,y) ((x/y)+(x%y!=0)*(x/abs(x)*y/abs(y)<0?-1:0))
#define YN(x) cout<<(x?"YES\n":"NO\n");
#define Yn(x) cout<<(x?"Yes\n":"No\n");
#define yn(x) cout<<(x?"yes\n":"no\n");
const int MAAX=1e18;
const int MOD=1e9+7;
const int MAX=1e9;

int dp[1010][1010];
int fun(int lft,int sum){
	if(lft==0)
		return sum==0;
	if(sum<0)
		return 0;
	int &ret=dp[lft][sum];
	if(~ret)
		return ret;
	return ret=(fun(lft-1,sum)+fun(lft-1,sum-1)+fun(lft-1,sum-2))%MOD;
}

in main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int tc=1;
    // cin>>tc;
    while(tc--){
    	memset(dp,-1,sizeof dp);
		int n;
		cin>>n;
		int ans=1;
		for(int i=1;i<n;i++){
			ans*=fun(i,i+1);
			ans%=MOD;
		}
		cout<<ans<<"\n";
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 11648kb

input:

3

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 2ms
memory: 11524kb

input:

4

output:

12

result:

ok 1 number(s): "12"

Test #3:

score: 0
Accepted
time: 0ms
memory: 11584kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 2ms
memory: 11644kb

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 1ms
memory: 11580kb

input:

5

output:

192

result:

ok 1 number(s): "192"

Test #6:

score: 0
Accepted
time: 1ms
memory: 11588kb

input:

6

output:

8640

result:

ok 1 number(s): "8640"

Test #7:

score: 0
Accepted
time: 1ms
memory: 11604kb

input:

7

output:

1088640

result:

ok 1 number(s): "1088640"

Test #8:

score: 0
Accepted
time: 0ms
memory: 11544kb

input:

8

output:

388644480

result:

ok 1 number(s): "388644480"

Test #9:

score: 0
Accepted
time: 2ms
memory: 11612kb

input:

9

output:

862788922

result:

ok 1 number(s): "862788922"

Test #10:

score: 0
Accepted
time: 0ms
memory: 11648kb

input:

10

output:

127378698

result:

ok 1 number(s): "127378698"

Test #11:

score: 0
Accepted
time: 2ms
memory: 11584kb

input:

11

output:

612120859

result:

ok 1 number(s): "612120859"

Test #12:

score: 0
Accepted
time: 2ms
memory: 11596kb

input:

12

output:

524731288

result:

ok 1 number(s): "524731288"

Test #13:

score: 0
Accepted
time: 1ms
memory: 11544kb

input:

13

output:

703838332

result:

ok 1 number(s): "703838332"

Test #14:

score: 0
Accepted
time: 1ms
memory: 11524kb

input:

14

output:

71786008

result:

ok 1 number(s): "71786008"

Test #15:

score: 0
Accepted
time: 1ms
memory: 11584kb

input:

15

output:

346731212

result:

ok 1 number(s): "346731212"

Test #16:

score: 0
Accepted
time: 0ms
memory: 11516kb

input:

38

output:

865127889

result:

ok 1 number(s): "865127889"

Test #17:

score: 0
Accepted
time: 0ms
memory: 11524kb

input:

64

output:

808637919

result:

ok 1 number(s): "808637919"

Test #18:

score: 0
Accepted
time: 0ms
memory: 11512kb

input:

41

output:

468077351

result:

ok 1 number(s): "468077351"

Test #19:

score: 0
Accepted
time: 0ms
memory: 11512kb

input:

67

output:

87996243

result:

ok 1 number(s): "87996243"

Test #20:

score: 0
Accepted
time: 2ms
memory: 11608kb

input:

93

output:

249426735

result:

ok 1 number(s): "249426735"

Test #21:

score: 0
Accepted
time: 1ms
memory: 11508kb

input:

38

output:

865127889

result:

ok 1 number(s): "865127889"

Test #22:

score: 0
Accepted
time: 2ms
memory: 11524kb

input:

97

output:

478905528

result:

ok 1 number(s): "478905528"

Test #23:

score: 0
Accepted
time: 0ms
memory: 11672kb

input:

42

output:

35251093

result:

ok 1 number(s): "35251093"

Test #24:

score: 0
Accepted
time: 0ms
memory: 11612kb

input:

68

output:

741983464

result:

ok 1 number(s): "741983464"

Test #25:

score: 0
Accepted
time: 0ms
memory: 11616kb

input:

88

output:

774085871

result:

ok 1 number(s): "774085871"

Test #26:

score: 0
Accepted
time: 0ms
memory: 11584kb

input:

146

output:

463722912

result:

ok 1 number(s): "463722912"

Test #27:

score: 0
Accepted
time: 2ms
memory: 11516kb

input:

694

output:

524438366

result:

ok 1 number(s): "524438366"

Test #28:

score: 0
Accepted
time: 0ms
memory: 11580kb

input:

341

output:

240079920

result:

ok 1 number(s): "240079920"

Test #29:

score: 0
Accepted
time: 4ms
memory: 11612kb

input:

582

output:

971591101

result:

ok 1 number(s): "971591101"

Test #30:

score: 0
Accepted
time: 3ms
memory: 11560kb

input:

536

output:

135071031

result:

ok 1 number(s): "135071031"

Test #31:

score: 0
Accepted
time: 5ms
memory: 11700kb

input:

777

output:

715343919

result:

ok 1 number(s): "715343919"

Test #32:

score: 0
Accepted
time: 0ms
memory: 11588kb

input:

424

output:

640304651

result:

ok 1 number(s): "640304651"

Test #33:

score: 0
Accepted
time: 5ms
memory: 11612kb

input:

665

output:

674722290

result:

ok 1 number(s): "674722290"

Test #34:

score: 0
Accepted
time: 2ms
memory: 11600kb

input:

619

output:

318882692

result:

ok 1 number(s): "318882692"

Test #35:

score: 0
Accepted
time: 0ms
memory: 11544kb

input:

581

output:

596324753

result:

ok 1 number(s): "596324753"

Test #36:

score: -100
Runtime Error

input:

4325

output:


result: