Блог пользователя Sammmmmmm

Автор Sammmmmmm, история, 4 дня назад, По-английски

Given an array of n integers. In 1 operation you can swap 2 adjacent elements a[i] and a[i + 1] if and only if a[i] + a[i + 1] <=

k. Count the number of possible arrays that can be created using a series of operations (possibly none). Two arrays a and b are

considered different if there exists an index i so that a[i] != b[i]

N <= 1e5

K <= 1e9

Ai <= 1e9

Thanks!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор Sammmmmmm, история, 3 месяца назад, По-английски

Given R red balls, B blue balls, and G green balls. Count ways to arrange them so that there are exactly k pair RB (red ball is

in front of blue ball).

K <= min(R, B) R, B, G, K <= 1e6

Thanks!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

Автор Sammmmmmm, история, 3 месяца назад, По-английски

Given an array of n integers and k. Count the number of permutations of the array so that the sum of each adjacent element >= k. Two permutations are different if they are different as arrays (There exists an index i so that a[i] != b[i])

N <= 2e5; K, Ai <= 1e9

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Sammmmmmm, история, 9 месяцев назад, По-английски

Given an empty graph of n vertices and q queries.

Each queries is in the form of (x, y, l) which means you add edges (x + i, y + i) for 0 <= i <= l — 1

Report the number of connected components after q queries.

If I'm not mistaken, I remember there's a trick involving creating log2(n) DSU but I can't make out the details.

Can someone help? Thanks.

N <= 1e5

Q <= 1e5

Полный текст и комментарии »

  • Проголосовать: нравится
  • +17
  • Проголосовать: не нравится

Автор Sammmmmmm, история, 9 месяцев назад, По-английски

Given an N * N matrix consisting of k ones and the rest are 0s.Count the number of connected components that contains only zeros

N <= 1e9

K <= 1e5

Thanks!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +11
  • Проголосовать: не нравится

Автор Sammmmmmm, история, 10 месяцев назад, По-английски

Hi can someone help me with this problem? Thanks

Link: https://oj.uz/problem/view/JOI18_candies

For every k where 1 <= k <= n / 2, find out what's the maximum total value you can achieved by choosing k elements from an array of n integers, and no 2 consecutive elements are chosen.

N <= 2e5;

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Sammmmmmm, история, 10 месяцев назад, По-английски

Given an array of N integers. Count pairs (i, j) so that (A[i] & A[j]) = 0

N <= 1e5;

Ai <= 1e9

Полный текст и комментарии »

  • Проголосовать: нравится
  • +16
  • Проголосовать: не нравится

Автор Sammmmmmm, история, 10 месяцев назад, По-английски

I have been doing JOI problems lately and I really liked them! Can someone suggest me some problems to do? Thanks. It could be from open contest, finals or spring camp :))

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Sammmmmmm, история, 10 месяцев назад, По-английски

Hi I've been looking at solutions for https://oj.uz/problem/view/NOI19_feast and I saw some kind of binary search but I don't really understand the idea behind it. Can someone help? Thanks

Given an array of n integers, split it into at most k subarray that are pair-wise disjoint so that the sum of those subarray are maximized.

N, K <= 3e5

|Ai| <= 1e9

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Sammmmmmm, история, 10 месяцев назад, По-английски

Given two arrays a[] and w[] of n integers. The cost for a subarray [l, r] is max(w[l], w[l + 1].., w[r]) * (a[l] + a[l] +.. a[r]) Divide the array into k subarray so that the total cost is minimized. Thanks

n, k <= 2500 a[i] <= 2500 with 1 <= i <= n w[i] <= 1e9 with 1 <= i <= n

You can submit here: https://www.codechef.com/INOIPRAC/problems/INOI2301?tab=statement

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор Sammmmmmm, история, 10 месяцев назад, По-английски

Given two permutations a and b of n elements.

Find the sum of inversion for each permutation that whose lexicographical value is between a and b mod = 1e9 + 7.

N <= 200000

Thanks in advance!

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится