QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#124639#5532. KangarooBenzenesir100 ✓8ms28216kbC++141.3kb2023-07-15 11:38:372023-07-15 11:38:39

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-15 11:38:39]
  • 评测
  • 测评结果:100
  • 用时:8ms
  • 内存:28216kb
  • [2023-07-15 11:38:37]
  • 提交

answer

#include <cstdio>
#include <cmath>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <stack>
#include <tuple>
#include <bitset>
#define ll long long
#define ull unsigned long long
#define ld long double
#define fp(a,b,c) for(ll a=b;a<=c;a++)
#define fd(a,b,c) for(ll a=b;a>=c;a--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define inf 0x3f3f3f3f
#define base 127
#define mod 1000000007
#define eb emplace_back
#define pb pop_back
#define y1 y114
#define y0 y514
#define x1 x114
#define x0 x514
#define fill(x,y) memset(x,y,sizeof(x))
#define mpr make_pair
#define met(x,t) memset(x,t,sizeof(x))

using namespace std;

inline int rd(){
	int x = 0, f = 1;char ch = getchar();
	while(ch < '0' || ch > '9'){if(ch == '-')f = -1;ch = getchar();}
	while(ch >= '0' && ch <= '9')x = (x<<1) + (x<<3) + (ch^48),ch = getchar();
	return x * f;}
const int maxN=3000;
int n,s,t;
int f[maxN][maxN];

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	n=rd(),s=rd(),t=rd();
	f[1][1]=1;
	fp(i,2,n){
		fp(j,1,i){
			if(i!=s&&t!=i) f[i][j]=(f[i-1][j+1]*j%mod+(j-(i>s)-(i>t))*f[i-1][j-1]%mod)%mod;
			else f[i][j]=f[i-1][j]+f[i-1][j-1];
		}
	}
	cout << f[n][1] << endl;
	
	return 0;
}

详细

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 1ms
memory: 3432kb

input:

7 3 6

output:

14

result:

ok 1 number(s): "14"

Subtask #2:

score: 30
Accepted

Dependency #1:

100%
Accepted

Test #2:

score: 30
Accepted
time: 1ms
memory: 3544kb

input:

39 36 32

output:

964903316

result:

ok 1 number(s): "964903316"

Test #3:

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

input:

26 1 26

output:

955348527

result:

ok 1 number(s): "955348527"

Test #4:

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

input:

40 11 33

output:

695661890

result:

ok 1 number(s): "695661890"

Test #5:

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

input:

39 39 38

output:

717149364

result:

ok 1 number(s): "717149364"

Test #6:

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

input:

40 10 25

output:

912929610

result:

ok 1 number(s): "912929610"

Test #7:

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

input:

37 25 23

output:

250748685

result:

ok 1 number(s): "250748685"

Test #8:

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

input:

39 2 38

output:

624060592

result:

ok 1 number(s): "624060592"

Test #9:

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

input:

40 18 22

output:

739993796

result:

ok 1 number(s): "739993796"

Test #10:

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

input:

40 11 35


output:

135213497

result:

ok 1 number(s): "135213497"

Subtask #3:

score: 15
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #11:

score: 15
Accepted
time: 0ms
memory: 5604kb

input:

199 100 70

output:

914653136

result:

ok 1 number(s): "914653136"

Test #12:

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

input:

187 3 40

output:

928785584

result:

ok 1 number(s): "928785584"

Test #13:

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

input:

199 198 197

output:

38412688

result:

ok 1 number(s): "38412688"

Test #14:

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

input:

200 40 140

output:

367088143

result:

ok 1 number(s): "367088143"

Test #15:

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

input:

199 111 3

output:

870834793

result:

ok 1 number(s): "870834793"

Test #16:

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

input:

200 133 73

output:

343127012

result:

ok 1 number(s): "343127012"

Test #17:

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

input:

178 15 163

output:

160852284

result:

ok 1 number(s): "160852284"

Test #18:

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

input:

197 43 79

output:

332057544

result:

ok 1 number(s): "332057544"

Test #19:

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

input:

200 33 79

output:

742545318

result:

ok 1 number(s): "742545318"

Subtask #4:

score: 49
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #20:

score: 49
Accepted
time: 0ms
memory: 11996kb

input:

658 169 438

output:

206087110

result:

ok 1 number(s): "206087110"

Test #21:

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

input:

700 207 509

output:

478311263

result:

ok 1 number(s): "478311263"

Test #22:

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

input:

755 139 507

output:

103783948

result:

ok 1 number(s): "103783948"

Test #23:

score: 0
Accepted
time: 6ms
memory: 26416kb

input:

2000 500 1500

output:

123410309

result:

ok 1 number(s): "123410309"

Test #24:

score: 0
Accepted
time: 8ms
memory: 28216kb

input:

2000 1000 1001

output:

956197482

result:

ok 1 number(s): "956197482"

Test #25:

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

input:

2000 666 1333

output:

993781645

result:

ok 1 number(s): "993781645"

Test #26:

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

input:

1991 198 677

output:

155058730

result:

ok 1 number(s): "155058730"

Test #27:

score: 0
Accepted
time: 8ms
memory: 20256kb

input:

1498 299 659

output:

665757882

result:

ok 1 number(s): "665757882"