getitright's blog

By getitright, history, 6 years ago, In English

Is there any codeforces test case scrapper available which can give me all the test cases of the problem? Also, how do I get to know the large test cases of the problem for which my solution failed?

Thanks.

Full text and comments »

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

By getitright, history, 7 years ago, In English

Hi Codeforces community, especially Indians

I was feeling sad while reading this answer from I_love_Tanya_Romanova and felt really bad that many indians are making the reputation of there country bad. It is a humble request to all indians to read this answer, especially point 6 onwards and try to behave in a more better manner.

Today I also saw the below image on Endagorion facebook profile.

Literally, what would you get by tagging someone in someone else profile photo. Then these "_/_" comments, i can bear them now.

So, indians read the above answer and behave properly. The name of country lies on hands of all it's citizens.

Full text and comments »

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

By getitright, history, 7 years ago, In English

Hi codeforces community,

I have been preparing for interview round for placements. I came across these 2 problems which I have not been able to solve for the past 2 days.

Q1) A and B play a game. They are given an array of positive numbers. Each player in his turn picks up 2 numbers from the array such that the difference of the numbers does not exist in the array. He then places the difference into the array too thus increase the array count by 1. Then the next player repeats the same process. The game continues till there are no 2 numbers such that difference does not exist in the array. The one who’s not able to choose numbers loses. If A starts the game and the game proceeds optimally, find who’ll win the game

Example : Input array : 2,5,3

A: 2,5,3,1

B: 2,5,3,1,4

A has no choice so B wins.

Q2) Given a string containing only lowercase alphabets, you have to convert it into a string such that it contains only vowels by doing minimum number of operations. In one operation, you could select a substring always starting from index 0, and move that substring forward or backward. Example of rolling forward or backward are given :

Rolling Forward

Input- axzf

Let index chosen be 0 to 3 and moving it forward

Output- byag

Rolling Backward

Input – axze

Let index chosen be 0 to 2 and moving it backwards

Output- zwyd

Please help me in solving the above problems. I would be highly thankful to you all.

UPDATE : Doubts are cleared. Thanks everyone for help.

Full text and comments »

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

By getitright, history, 7 years ago, In English

There are 2 people who play a game. The game is as follows:

The are P sticks, each of length Q meters in length. The player play in turns. For each move a player choses a stick and splits it into 2 or more equal parts, each having an integer length greater than or equal to S meters. Each resulting part is also a stick. The player who can't make a move loses and the other player wins.

If both the players play optimally, determine the winner, given the values of P, Q and S.

For example : 2

1 15 4

4 9 5

Answer:

Player 1

Player 2

Constrains: 1 <= T <= 10, the number of test cases

1 <= P, Q, S <= {10}9.

My approach till now: I was trying to solve this problem using grundy numbers. If the xor of grundy numbers of all piles is 0, player 2 is winner else player 1 is winner. Since all sticks are of same length, P = even number implies, player 2 is always the winner. When P = odd number, then if the grundy number of stick is 0, then player 2 is winner else player 1 is winner. The grundy is 0 only when all the proper divisors (i.e. except 1 and number itself) of the stick length are less than S.

Could anyone please verify whether my approach is correct or not?

Any help would be appreciated.

Full text and comments »

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