adarsh000321's blog

By adarsh000321, history, 4 years ago, In English

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?

Full text and comments »

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

By adarsh000321, history, 5 years ago, In English

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 :)

Full text and comments »

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

By adarsh000321, history, 5 years ago, In English

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

Full text and comments »

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

By adarsh000321, history, 5 years ago, In English

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... :)

Full text and comments »

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