#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,a[100005],b[100005],dp[100005][30];
main(){
//freopen("test.in","r",stdin);
cin>>n>>m;
for(int k=1;k<=n;k++)
cin>>a[k];
for(int k=1;k<=n;k++)
cin>>b[k];
int pas=1;
for(int k=1;k<=n;k++)
pas*=(a[k]+b[k]);
int sum=b[1];
dp[1][0]=b[1];
dp[1][1]=a[1];
for(int k=2;k<=n;k++){
sum*=b[k];
dp[k][0]=sum;
for(int i=1;i<m;i++){
if(k<i)
continue;
dp[k][i]=(b[k]*dp[k-1][i])+(a[k]*dp[k-1][i-1]);
}
}
int jam=0;
for(int i=0;i<m;i++)
jam+=dp[n][i];
cout<<pas-jam;
return 0;
}
Compilation message
relativnost.cpp:5:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
632 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
632 KB |
Output isn't correct |
3 |
Incorrect |
3 ms |
504 KB |
Output isn't correct |
4 |
Incorrect |
88 ms |
14712 KB |
Output isn't correct |
5 |
Incorrect |
144 ms |
23664 KB |
Output isn't correct |
6 |
Incorrect |
153 ms |
25144 KB |
Output isn't correct |
7 |
Incorrect |
106 ms |
17640 KB |
Output isn't correct |
8 |
Incorrect |
163 ms |
24952 KB |
Output isn't correct |
9 |
Incorrect |
137 ms |
20472 KB |
Output isn't correct |
10 |
Incorrect |
119 ms |
19448 KB |
Output isn't correct |