답안 #20076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20076 2016-02-25T09:47:27 Z gs13068 목공 (kriii4_A) C++
4 / 100
24 ms 1104 KB
#include <cstdio>
#include <map>

const int p = 1092616193;

using namespace std;

int f(int x, int y)
{
	return y & 1 ? (long long)f(x, y ^ 1)*x%p : y ? f((long long)x*x%p, y >> 1) : 1;
}

int a[1001];
int d[5005];

int main()
{
	int i, j, n, m, t, s = 0;
	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)
	{
		scanf("%d", a + i);
		s += a[i];
	}
	s = f(s, p - 2);
	for (i = n; i <= m; i++)
	{
		t = 0;
		for (j = 0; j < n; j++) t = (t + (long long)a[j] * d[i + j - n]) % p;
		d[i] = ((long long)t * s + 1) % p;
	}
	printf("%d", d[m]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 1104 KB Output is correct
2 Correct 21 ms 1104 KB Output is correct
3 Correct 22 ms 1104 KB Output is correct
4 Correct 22 ms 1104 KB Output is correct
5 Correct 23 ms 1104 KB Output is correct
6 Correct 21 ms 1104 KB Output is correct
7 Correct 21 ms 1104 KB Output is correct
8 Correct 24 ms 1104 KB Output is correct
9 Correct 22 ms 1104 KB Output is correct
10 Correct 23 ms 1104 KB Output is correct
11 Correct 21 ms 1104 KB Output is correct
12 Correct 22 ms 1104 KB Output is correct
13 Correct 21 ms 1104 KB Output is correct
14 Correct 24 ms 1104 KB Output is correct
15 Correct 23 ms 1104 KB Output is correct
16 Correct 21 ms 1104 KB Output is correct
17 Correct 21 ms 1104 KB Output is correct
18 Correct 21 ms 1104 KB Output is correct
19 Correct 0 ms 1104 KB Output is correct
20 Correct 0 ms 1104 KB Output is correct
21 Correct 14 ms 1104 KB Output is correct
22 Correct 14 ms 1104 KB Output is correct
23 Correct 14 ms 1104 KB Output is correct
24 Correct 14 ms 1104 KB Output is correct
25 Correct 14 ms 1104 KB Output is correct
26 Correct 14 ms 1104 KB Output is correct
27 Correct 14 ms 1104 KB Output is correct
28 Correct 14 ms 1104 KB Output is correct
29 Correct 14 ms 1104 KB Output is correct
30 Correct 14 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1100 KB futex (syscall #202) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -