Brankonymous's blog

By Brankonymous, history, 3 years ago, In English

In a now finished competition, I stumbled across a task that I didn't manage to solve it.

Define F(n,m) to be the number of sequences of length n which satisfy:

  • All elements of the sequence are positive divisors of m
  • For any two adjacent elements, say p and q, there exists at least one prime which divides both of them.

You are given two integers, n and m. Find the values of F(1,m), F(2,m), ... ,F(n,m) modulo 10^9+7

0 < n ≤ 10^5

0 < m ≤ 10^18

Here's link to the full task description.

Can somebody explain to me solution to this problem in detail?

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By Brankonymous, history, 5 years ago, In English

Does anyone know any source material or code, when given n coordinate points, you need to calculate area of given non-convex polygone.

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it

By Brankonymous, history, 5 years ago, In English

Hi, can someone help me solve this problem:

Input consist of integer n and array a of n integers. Output number of pairs (a[i],a[j]), i<j who are adjacent or for all k (i<k<j) this equation is true: a[k]<=min(a[i],a[j]).

1<=n<=10^6

0<=a[i]<=2^31

example:

8

4 1 2 3 6 5 1 2

Output: 11

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it