답안 #20015

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20015 2016-02-25T08:33:41 Z tonyjjw 목공 (kriii4_A) C++14
4 / 100
13 ms 1784 KB
//*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1092616193
#define MAX 0x3f3f3f3f
#define MAX2 0x3f3f3f3f3f3f3f3fll
#define ERR 1e-10
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

ll mul_inv(ll a, ll b=MOD)
{
	ll b0=b, t, q;
	ll x0=0, x1=1;
	if(b == 1) return 1;
	while(a > 1)
	{
		q=a/b;
		t=b, b=a%b, a=t;
		t=x0, x0=x1-q*x0, x1=t;
	}
	if(x1 < 0) x1+=b0;
	return x1;
}


int n, m;
ll p[2000];
ll d[6000];

int main()
{
	int i, j, k;
	cin>>n>>m;
	ll sum=0;
	for(i=0;i<n;i++)
	{
		scanf("%lld", &p[i]);
		sum+=p[i];
	}
	for(i=0;i<n;i++) p[i]*=mul_inv(sum), p[i]%=MOD;
	for(i=n;i<=m;i++)
	{
		ll sum=0;
		for(j=0;j<=n-1;j++)
		{
			sum+=d[i-(n-j)]*p[j]%MOD;
		}
		sum++;
		sum%=MOD;
		d[i]=sum;
	}
	cout<<d[m];
	return 0;
}
//*/
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1784 KB Output is correct
2 Correct 12 ms 1784 KB Output is correct
3 Correct 12 ms 1784 KB Output is correct
4 Correct 12 ms 1784 KB Output is correct
5 Correct 13 ms 1784 KB Output is correct
6 Correct 12 ms 1784 KB Output is correct
7 Correct 11 ms 1784 KB Output is correct
8 Correct 13 ms 1784 KB Output is correct
9 Correct 12 ms 1784 KB Output is correct
10 Correct 13 ms 1784 KB Output is correct
11 Correct 12 ms 1784 KB Output is correct
12 Correct 11 ms 1784 KB Output is correct
13 Correct 12 ms 1784 KB Output is correct
14 Correct 13 ms 1784 KB Output is correct
15 Correct 12 ms 1784 KB Output is correct
16 Correct 12 ms 1784 KB Output is correct
17 Correct 11 ms 1784 KB Output is correct
18 Correct 12 ms 1784 KB Output is correct
19 Correct 0 ms 1784 KB Output is correct
20 Correct 0 ms 1784 KB Output is correct
21 Correct 8 ms 1784 KB Output is correct
22 Correct 8 ms 1784 KB Output is correct
23 Correct 7 ms 1784 KB Output is correct
24 Correct 8 ms 1784 KB Output is correct
25 Correct 8 ms 1784 KB Output is correct
26 Correct 7 ms 1784 KB Output is correct
27 Correct 8 ms 1784 KB Output is correct
28 Correct 8 ms 1784 KB Output is correct
29 Correct 7 ms 1784 KB Output is correct
30 Correct 7 ms 1784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1780 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -