# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
164156 | beso123 | Relativnost (COCI15_relativnost) | C++14 | 163 ms | 25144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |