QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#415820#7365. 东方永夜抄juan_12320 2ms3576kbC++14493b2024-05-21 10:41:112024-05-21 10:41:12

Judging History

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

  • [2024-05-21 10:41:12]
  • 评测
  • 测评结果:20
  • 用时:2ms
  • 内存:3576kb
  • [2024-05-21 10:41:11]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1000000007;
int n,k,A;
int s[15],v[15];
int dp[2005];
int val[2005];
signed main(){
	cin >> n >> k >> A;
	for(int i = 1;i<=n;i++)val[i] = A;
	for(int i = 1;i<=k;i++){
		int s,v;cin >>s  >> v;
		val[s] = v;
	}
	dp[1] =1;
	for(int i = 2;i<=n;i++){
		for(int j = 1;j<i;j++){
			dp[i] = (dp[j]*dp[i-j]%mod*val[j]+dp[i])%mod;
		}
	}
	cout << dp[n] << endl;
	return 0;
}/*
6 2 1
2 3
4 5
*/

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 2ms
memory: 3416kb

input:

729 8 484700931
300 598694964
423 187474540
314 419022666
254 94296176
129 888635716
221 631534755
219 448268736
43 487182990

output:

599001030

result:

ok single line: '599001030'

Test #2:

score: 20
Accepted
time: 2ms
memory: 3544kb

input:

761 8 119599063
1 420201406
2 187241921
3 264743797
4 55963177
5 69498518
6 634982960
7 645203226
8 920001009

output:

114033655

result:

ok single line: '114033655'

Test #3:

score: 20
Accepted
time: 2ms
memory: 3576kb

input:

840 6 435950652
52 883838625
38 308350134
11 289251261
18 150936562
9 234103210
42 763142373

output:

616532808

result:

ok single line: '616532808'

Subtask #2:

score: 0
Runtime Error

Test #4:

score: 0
Runtime Error

input:

604314 0 881389884

output:


result:


Subtask #3:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Test #6:

score: 0
Runtime Error

input:

40223 10 593585017
715 890967134
1318 849296717
823 911337804
1918 176598406
2309 108880127
224 458183236
5170 703142296
4283 596249924
7136 89478205
8789 657842023

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%