QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#415836#7365. 东方永夜抄juan_1230 62ms3600kbC++14856b2024-05-21 11:00:032024-05-21 11:00:04

Judging History

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

  • [2024-05-21 11:00:04]
  • 评测
  • 测评结果:0
  • 用时:62ms
  • 内存:3600kb
  • [2024-05-21 11:00:03]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1000000007;
int qp(int p,int q){
	int ans = 1,pro = p;
	while(q){
		if(q&1)ans = ans*pro%mod;
		pro = pro*pro%mod;q>>=1;
	}
	return ans;
}
int n,k,A;
int s[15],v[15];
int dp[50005];
int val[50005];
signed main(){
	cin >> n >> k >> A;
	if(k == 0){n--;
		int pro = 1;
		for(int i = n+1;i<=2*n;i++)pro = pro*i%mod;
		for(int i = 1;i<=n+1;i++)pro = pro*qp(i,mod-2)%mod;
		cout << pro << endl;return 0;
	}
	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;
		}
	}
	for(int i = 1;i<=n;i++)cout << dp[i] << ' ';cout << endl;
	cout << dp[n] << endl;
	return 0;
}/*
20 0 1

*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

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

output:

1 484700931 735443655 953128138 127661124 666492567 185560603 554652763 753124645 719894194 291719574 416311553 613991150 955521758 424898598 387131534 730408101 316930691 528420978 553495941 252284083 97709433 945714406 398467892 486402262 422910612 629293644 11039134 892265196 656355380 453449978 ...

result:

wrong answer 1st lines differ - expected: '599001030', found: '1 484700931 735443655 95312813... 582627611 980885926 599001030 '

Subtask #2:

score: 0
Wrong Answer

Test #4:

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

input:

604314 0 881389884

output:

369090543

result:

wrong answer 1st lines differ - expected: '110655526', found: '369090543'

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%