QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#415821#7365. 东方永夜抄juan_12320 1ms3684kbC++14495b2024-05-21 10:41:442024-05-21 10:41:45

Judging History

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

  • [2024-05-21 10:41:45]
  • 评测
  • 测评结果:20
  • 用时:1ms
  • 内存:3684kb
  • [2024-05-21 10:41:44]
  • 提交

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[50005];
int val[50005];
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
*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

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

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: 0
Accepted
time: 1ms
memory: 3684kb

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: 0
Accepted
time: 0ms
memory: 3608kb

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
Time Limit Exceeded

Dependency #1:

100%
Accepted

Test #6:

score: 0
Time Limit Exceeded

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%