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

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

Note: This problem has been asked in one of the online coding challenges.

Given an array A of size N. You are asked Q queries. There will be two types of queries:

1 L R K: Print “Yes” if the subarray A[L, R] can be split into K contiguous subarrays such that each of these K subarrays have a subarray XOR with odd number od set bits. Otherwise, print “No”.

2 L X: Update A[L] = X .

Constraints: 1 <= A[i] <= 1e9 1 <= L, R, K <= N 1 <= N, Q <= 1e5

Can anyone give me some idea about how to solve this problem?

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

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

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

Hello Codeforces, I actually have two codes (69520703 and 69521121) that are doing the same thing but i just changed the order of the states and one of them is giving TLE (at test case: 78)and the other got AC. Can you please help me out. Dislike if you want but please reply :)

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

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

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

Hello Codeforces, I am stuck in one of the challenges , all i can think of is dp, but i dont know how to implement that and i also think that the given sample test case( not in image) was wrong because possible arrangements for n=3 and p=1 are {1,2,3},{3,2,1},{3,1,2} that is, there are 3 arrangements but sample output was 2 ; link to image : https://drive.google.com/open?id=1y3CARnR4_KUKP6z3iUcMKhePkZWg6IS4

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

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

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

In this spoj problem https://www.spoj.com/HSPLARCH/problems/HS08AKP/ constraints are bigger i.e., we cannot use 2D Knapsack so how else can we print the solutions in space optimized knapsack? Help would be greatly appreciated... :)

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

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