QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#461042#8483. Count the Christmas TreesLynkcat#AC ✓107ms101460kbC++14928b2024-07-02 15:24:592024-07-02 15:24:59

Judging History

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

  • [2024-07-02 15:24:59]
  • 评测
  • 测评结果:AC
  • 用时:107ms
  • 内存:101460kb
  • [2024-07-02 15:24:59]
  • 提交

answer

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 1000000007
#define sz(x) ((int)((x).size()))
// #define int ll
// #define N 
using namespace std;
int f[5005][5005];
void BellaKira()
{
    int n;
    cin>>n;
    f[0][0]=1;
    for (int x=1;x<=5000;x++)
        for (int y=0;y<=5000;y++)
            if (x+y)
            {
                f[x][y]=(f[x][y]+f[x-1][y])%mod;
                if (y>=1) f[x][y]=(f[x][y]+f[x-1][y-1])%mod;
                if (y>=2) f[x][y]=(f[x][y]+f[x-1][y-2])%mod;
            }

    int ans=1;
    for (int i=2;i<=n;i++)
        ans=1ll*ans*f[i-1][i]%mod;
    cout<<ans<<'\n';
}
signed main()
{
	IOS;
	cin.tie(0);
	int T=1;
	while (T--)
	{
		BellaKira();
	}
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 79ms
memory: 101456kb

input:

3

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 94ms
memory: 101456kb

input:

4

output:

12

result:

ok 1 number(s): "12"

Test #3:

score: 0
Accepted
time: 95ms
memory: 101392kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 81ms
memory: 101264kb

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 104ms
memory: 101380kb

input:

5

output:

192

result:

ok 1 number(s): "192"

Test #6:

score: 0
Accepted
time: 83ms
memory: 101456kb

input:

6

output:

8640

result:

ok 1 number(s): "8640"

Test #7:

score: 0
Accepted
time: 99ms
memory: 101456kb

input:

7

output:

1088640

result:

ok 1 number(s): "1088640"

Test #8:

score: 0
Accepted
time: 102ms
memory: 101324kb

input:

8

output:

388644480

result:

ok 1 number(s): "388644480"

Test #9:

score: 0
Accepted
time: 90ms
memory: 101376kb

input:

9

output:

862788922

result:

ok 1 number(s): "862788922"

Test #10:

score: 0
Accepted
time: 102ms
memory: 101364kb

input:

10

output:

127378698

result:

ok 1 number(s): "127378698"

Test #11:

score: 0
Accepted
time: 63ms
memory: 101304kb

input:

11

output:

612120859

result:

ok 1 number(s): "612120859"

Test #12:

score: 0
Accepted
time: 93ms
memory: 101308kb

input:

12

output:

524731288

result:

ok 1 number(s): "524731288"

Test #13:

score: 0
Accepted
time: 80ms
memory: 101376kb

input:

13

output:

703838332

result:

ok 1 number(s): "703838332"

Test #14:

score: 0
Accepted
time: 74ms
memory: 101460kb

input:

14

output:

71786008

result:

ok 1 number(s): "71786008"

Test #15:

score: 0
Accepted
time: 72ms
memory: 101396kb

input:

15

output:

346731212

result:

ok 1 number(s): "346731212"

Test #16:

score: 0
Accepted
time: 83ms
memory: 101296kb

input:

38

output:

865127889

result:

ok 1 number(s): "865127889"

Test #17:

score: 0
Accepted
time: 59ms
memory: 101324kb

input:

64

output:

808637919

result:

ok 1 number(s): "808637919"

Test #18:

score: 0
Accepted
time: 101ms
memory: 101392kb

input:

41

output:

468077351

result:

ok 1 number(s): "468077351"

Test #19:

score: 0
Accepted
time: 83ms
memory: 101300kb

input:

67

output:

87996243

result:

ok 1 number(s): "87996243"

Test #20:

score: 0
Accepted
time: 88ms
memory: 101364kb

input:

93

output:

249426735

result:

ok 1 number(s): "249426735"

Test #21:

score: 0
Accepted
time: 91ms
memory: 101372kb

input:

38

output:

865127889

result:

ok 1 number(s): "865127889"

Test #22:

score: 0
Accepted
time: 89ms
memory: 101308kb

input:

97

output:

478905528

result:

ok 1 number(s): "478905528"

Test #23:

score: 0
Accepted
time: 82ms
memory: 101384kb

input:

42

output:

35251093

result:

ok 1 number(s): "35251093"

Test #24:

score: 0
Accepted
time: 107ms
memory: 101376kb

input:

68

output:

741983464

result:

ok 1 number(s): "741983464"

Test #25:

score: 0
Accepted
time: 86ms
memory: 101364kb

input:

88

output:

774085871

result:

ok 1 number(s): "774085871"

Test #26:

score: 0
Accepted
time: 83ms
memory: 101368kb

input:

146

output:

463722912

result:

ok 1 number(s): "463722912"

Test #27:

score: 0
Accepted
time: 103ms
memory: 101300kb

input:

694

output:

524438366

result:

ok 1 number(s): "524438366"

Test #28:

score: 0
Accepted
time: 102ms
memory: 101328kb

input:

341

output:

240079920

result:

ok 1 number(s): "240079920"

Test #29:

score: 0
Accepted
time: 81ms
memory: 101396kb

input:

582

output:

971591101

result:

ok 1 number(s): "971591101"

Test #30:

score: 0
Accepted
time: 91ms
memory: 101396kb

input:

536

output:

135071031

result:

ok 1 number(s): "135071031"

Test #31:

score: 0
Accepted
time: 97ms
memory: 101364kb

input:

777

output:

715343919

result:

ok 1 number(s): "715343919"

Test #32:

score: 0
Accepted
time: 79ms
memory: 101440kb

input:

424

output:

640304651

result:

ok 1 number(s): "640304651"

Test #33:

score: 0
Accepted
time: 93ms
memory: 101460kb

input:

665

output:

674722290

result:

ok 1 number(s): "674722290"

Test #34:

score: 0
Accepted
time: 75ms
memory: 101368kb

input:

619

output:

318882692

result:

ok 1 number(s): "318882692"

Test #35:

score: 0
Accepted
time: 87ms
memory: 101308kb

input:

581

output:

596324753

result:

ok 1 number(s): "596324753"

Test #36:

score: 0
Accepted
time: 87ms
memory: 101388kb

input:

4325

output:

525474695

result:

ok 1 number(s): "525474695"

Test #37:

score: 0
Accepted
time: 85ms
memory: 101360kb

input:

4807

output:

564080175

result:

ok 1 number(s): "564080175"

Test #38:

score: 0
Accepted
time: 86ms
memory: 101456kb

input:

4908

output:

200443472

result:

ok 1 number(s): "200443472"

Test #39:

score: 0
Accepted
time: 87ms
memory: 101376kb

input:

4389

output:

875654571

result:

ok 1 number(s): "875654571"

Test #40:

score: 0
Accepted
time: 95ms
memory: 101380kb

input:

4109

output:

718073816

result:

ok 1 number(s): "718073816"

Test #41:

score: 0
Accepted
time: 73ms
memory: 101364kb

input:

4591

output:

513602210

result:

ok 1 number(s): "513602210"

Test #42:

score: 0
Accepted
time: 82ms
memory: 101380kb

input:

4692

output:

702018749

result:

ok 1 number(s): "702018749"

Test #43:

score: 0
Accepted
time: 97ms
memory: 101380kb

input:

4793

output:

966993722

result:

ok 1 number(s): "966993722"

Test #44:

score: 0
Accepted
time: 75ms
memory: 101384kb

input:

4894

output:

80095551

result:

ok 1 number(s): "80095551"

Test #45:

score: 0
Accepted
time: 89ms
memory: 101300kb

input:

4690

output:

716441253

result:

ok 1 number(s): "716441253"

Test #46:

score: 0
Accepted
time: 94ms
memory: 101308kb

input:

5000

output:

514043793

result:

ok 1 number(s): "514043793"

Extra Test:

score: 0
Extra Test Passed