QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#18222#2115. Od deski do deski [A]Appleblue17#3 62ms80916kbC++425b2022-01-16 20:49:472022-05-04 17:22:26

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-04 17:22:26]
  • 评测
  • 测评结果:3
  • 用时:62ms
  • 内存:80916kb
  • [2022-01-16 20:49:47]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=3300,mod=1e9+7;
int n,m,ans;
int dp[N][N][2];

int main(){
	cin>>n>>m;
	dp[0][0][1]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=n;j++){
			dp[i][j][1]=(dp[i-1][j][1]+dp[i-1][j][0])%mod*j%mod;
			if(j) dp[i][j][0]=(1ll*dp[i-1][j-1][1]*(m-j+1)%mod+1ll*dp[i-1][j][0]*(m-j)%mod)%mod;
		}
	}
	for(int i=0;i<=n;i++) ans=(ans+dp[n][i][1])%mod; 
	cout<<ans;
}

详细

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 3ms
memory: 3684kb

input:

4 2

output:

10

result:

ok single line: '10'

Test #2:

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

input:

1 1

output:

0

result:

ok single line: '0'

Test #3:

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

input:

1 3

output:

0

result:

ok single line: '0'

Test #4:

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

input:

1 5

output:

0

result:

ok single line: '0'

Test #5:

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

input:

2 2

output:

2

result:

ok single line: '2'

Test #6:

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

input:

2 4

output:

4

result:

ok single line: '4'

Test #7:

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

input:

3 1

output:

1

result:

ok single line: '1'

Test #8:

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

input:

3 3

output:

9

result:

ok single line: '9'

Test #9:

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

input:

3 5

output:

25

result:

ok single line: '25'

Test #10:

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

input:

4 2

output:

10

result:

ok single line: '10'

Test #11:

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

input:

4 4

output:

76

result:

ok single line: '76'

Test #12:

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

input:

5 1

output:

1

result:

ok single line: '1'

Test #13:

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

input:

5 3

output:

117

result:

ok single line: '117'

Test #14:

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

input:

5 5

output:

825

result:

ok single line: '825'

Test #15:

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

input:

7 2

output:

116

result:

ok single line: '116'

Test #16:

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

input:

9 2

output:

496

result:

ok single line: '496'

Test #17:

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

input:

11 2

output:

2028

result:

ok single line: '2028'

Test #18:

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

input:

13 2

output:

8168

result:

ok single line: '8168'

Test #19:

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

input:

10 3

output:

48237

result:

ok single line: '48237'

Subtask #2:

score: 1
Accepted

Test #20:

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

input:

1 2

output:

0

result:

ok single line: '0'

Test #21:

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

input:

1 4

output:

0

result:

ok single line: '0'

Test #22:

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

input:

2 1

output:

1

result:

ok single line: '1'

Test #23:

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

input:

2 3

output:

3

result:

ok single line: '3'

Test #24:

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

input:

2 5

output:

5

result:

ok single line: '5'

Test #25:

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

input:

3 2

output:

4

result:

ok single line: '4'

Test #26:

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

input:

3 4

output:

16

result:

ok single line: '16'

Test #27:

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

input:

4 1

output:

1

result:

ok single line: '1'

Test #28:

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

input:

4 3

output:

33

result:

ok single line: '33'

Test #29:

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

input:

4 5

output:

145

result:

ok single line: '145'

Test #30:

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

input:

5 2

output:

24

result:

ok single line: '24'

Test #31:

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

input:

5 4

output:

352

result:

ok single line: '352'

Test #32:

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

input:

6 2

output:

54

result:

ok single line: '54'

Test #33:

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

input:

8 2

output:

242

result:

ok single line: '242'

Test #34:

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

input:

10 2

output:

1006

result:

ok single line: '1006'

Test #35:

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

input:

12 2

output:

4074

result:

ok single line: '4074'

Test #36:

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

input:

14 2

output:

16358

result:

ok single line: '16358'

Subtask #3:

score: 1
Accepted

Test #37:

score: 1
Accepted
time: 18ms
memory: 33304kb

input:

1689 2

output:

998472085

result:

ok single line: '998472085'

Test #38:

score: 0
Accepted
time: 46ms
memory: 73592kb

input:

2748 2

output:

451726470

result:

ok single line: '451726470'

Test #39:

score: 0
Accepted
time: 16ms
memory: 20564kb

input:

1204 2

output:

449822862

result:

ok single line: '449822862'

Test #40:

score: 0
Accepted
time: 46ms
memory: 72640kb

input:

2727 2

output:

203224669

result:

ok single line: '203224669'

Test #41:

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

input:

984 2

output:

175698237

result:

ok single line: '175698237'

Test #42:

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

input:

3000 2

output:

165694478

result:

ok single line: '165694478'

Subtask #4:

score: 0
Wrong Answer

Test #43:

score: 0
Wrong Answer
time: 4ms
memory: 5588kb

input:

97 83

output:

141341373

result:

wrong answer 1st lines differ - expected: '613159502', found: '141341373'

Subtask #5:

score: 0
Wrong Answer

Test #50:

score: 0
Wrong Answer
time: 9ms
memory: 19936kb

input:

1168 346407973

output:

-872180753

result:

wrong answer 1st lines differ - expected: '112579949', found: '-872180753'

Subtask #6:

score: 0
Wrong Answer

Test #55:

score: 0
Wrong Answer
time: 2ms
memory: 6004kb

input:

123 468402382

output:

837845523

result:

wrong answer 1st lines differ - expected: '827499041', found: '837845523'

Subtask #7:

score: 0
Wrong Answer

Test #60:

score: 0
Wrong Answer
time: 11ms
memory: 12744kb

input:

779 140176290

output:

-608979423

result:

wrong answer 1st lines differ - expected: '438118426', found: '-608979423'

Subtask #8:

score: 0
Wrong Answer

Test #65:

score: 0
Wrong Answer
time: 41ms
memory: 54948kb

input:

2315 21373850

output:

-450669933

result:

wrong answer 1st lines differ - expected: '692830582', found: '-450669933'

Subtask #9:

score: 0
Wrong Answer

Test #71:

score: 0
Wrong Answer
time: 61ms
memory: 68224kb

input:

2631 684393357

output:

-253953585

result:

wrong answer 1st lines differ - expected: '936211679', found: '-253953585'

Subtask #10:

score: 0
Wrong Answer

Test #77:

score: 0
Wrong Answer
time: 62ms
memory: 80916kb

input:

3000 1000000000

output:

799636673

result:

wrong answer 1st lines differ - expected: '543073891', found: '799636673'