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

Автор dunjen_master, история, 5 лет назад, По-английски

Can anyone explain their solution to any of the last 4 problems.

  • Question 3 Apples and Oranges (Contest:16th Feb) Tono is super fond of eating oranges and apples alone, but not so fond of eating them together. Today, she finds that all the 'n' apples and the 'm' oranges that she has are kept in a straight line. As she does not like apples and oranges together, find the expected number of unwanted pairs (adjacent) of apples and oranges if all the arrangements of apples and oranges have equal probability.For example:"O A O A" have 3 unwanted pairs while "O O A A" has 1 unwanted pair.
  • Question 4 Min query (contest 16th feb) You are given a rooted tree with N nodes and node 1 as root. Node i initially has a value A[i]. You have to process Q queries on it. Query can be of two type Type 1: Find the minimum element in the subtree of Node X. Type 2: Change all the elements in the subtree of Node X to thier value xor K.
  • Question 5 Game of bits (contest 16th feb) F(1,x) = number of set bits in the binary representation of the number x F(k,x) = F(k-1, F(1, x)) ; k > 1 You have to find the number of x for 1 <= x <= N such that the smallest k for which F(k, x) = 1 is C. For example smallest k for x = 1 is 1 x = 2 is 1 x = 3 is 2 x = 4 is 1 x = 5 is 2
  • Question 6 Tricky Chapo! (Contest: 16th Feb) As always, Sid has come up with a new problem on Number Theory. Since it is too tricky to solve, can you help him. A bonus, you'll get a chapo for solving it right. Given an integer n, let F(n) be the product of all positive integers i less or equal than n such that n and i are co-prime. Now you're given an integer X, you need to find the sum of (F(i) modulo i) for all positive integers i less than or equal to X. If the answer is A, report the value of (A % 1000000007).

  • The contest has ended

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

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

Автор dunjen_master, история, 5 лет назад, По-английски

Can somebody explain their solutions to problems-

1) Promotion Game 2) Count Diameters

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

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

Автор dunjen_master, история, 5 лет назад, По-английски

I am attaching a picture about the question. Kindly refer to the picture.

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

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

Автор dunjen_master, история, 5 лет назад, По-английски

You are given an array consisting of N elements. You can perform two operations any no. of times. 1. Make any even element E = E/2. and 2. Make any odd element E = 2E.

You have to minimize the maximum absolute difference between any two elements

For ex- N=2 {1,2}

We can make 2--> 2/2 = 1 Thus answer = 0

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

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

Автор dunjen_master, история, 6 лет назад, По-английски

Her is the link to my submission on which i got WA at pretest 11 https://mirror.codeforces.com/contest/1139/submission/51643042

I just uncommented the line ans=(ans+mod)%mod and it got accpeted although in the previous line i had done ans=(? -ans +mod)%mod.

Someone please explain me why did my code failed at test 11 ?

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

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

Автор dunjen_master, история, 6 лет назад, По-английски

Here is the problem statement https://www.codechef.com/problems/FAVNUM Link to my solution https://www.codechef.com/viewsolution/22195079 I have tried my code on few cases and it works i am not able to find my mistake. Please help!!

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

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