RedBlackTrees's blog

By RedBlackTrees, history, 19 months ago, In English

Hi! I was upsolving a question CodeForces Round Div2 #821 C. https://codeforces.com/problemset/problem/1733/C.

My approach is pretty simple. Just make all the elements of the array equal. To accomplish this...

1) The consecutive index sum is always odd as (even + odd = odd). So, just print out n-1 operations as we don't have to find the minimum and run the loop from the last index till the first index and make all the elements of the array equal to the last element.

So, for example for an array [4, 3, 2, 1], the answer from my approach should be:

3

(3, 4) (2, 3) (1, 2)

which will give you an array [1,1,1,1] which is non decreasing.

This is my submission https://codeforces.com/contest/1733/submission/173866286

Full text and comments »

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

By RedBlackTrees, history, 3 years ago, In English

Hello, everyone. In the question cAPS lOCK, the judge said the wrong answer for test case number 3, i.e, 'cAPSlOCK'. Now, from reading the question and the following conditions being given:

"Let's consider that a word has been typed with the Caps lock key accidentally switched on, if:

a) either it only contains uppercase letters; b) or all letters except for the first one are uppercase."

taking the above conditions into consideration, 'cAPSlOCK' should change to 'CapsLock' as apart from 'c' not all the words are lowercase, i.e, 'l'.

My submission number is #123967359 and it can also be found at https://pastebin.com/6EazS8Ph. So, my code converts 'cAPSlOCK' to 'CapsLock', however the desired answer is 'cAPSlOCK'

I highly appreciate anyone's input here.

Full text and comments »

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