AvadaKedavara's blog

By AvadaKedavara, history, 3 days ago, In English

Problem Name: Monsters.

There are N Monsters numbered from 1 to N , each of type Fire, Water or Grass represented by a string A of length N . When two Monsters battle each other, one of them wins according to the following rules: • A Fire Monster always defeats a Grass Monster. • A Water Monster always defeats a Fire Monster. • A Grass Monster always defeats a Water Monster. • In a battle between two Monsters of the same type, either one can win. Answer Q queries of the following form: if the Monsters Lj ...Rj are standing in a line from left to right, and repeatedly, two adjacent Monsters battle each other with the loser leaving the line, how many Monsters can be the last remaining Monster in at least one valid sequence of events?

Problem Link: Monsters

Full text and comments »

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

By AvadaKedavara, history, 5 months ago, In English

After two years I finally reached pupil on Codeforces.

Full text and comments »

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

By AvadaKedavara, history, 6 months ago, In English

I use Visual Studio Code with CPH and Thorium browser. I am just curious about what tools do you use to do competitive programming.

Full text and comments »

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

By AvadaKedavara, history, 6 months ago, In English

In the problem Swaps [problem:https://codeforces.net/problemset/problem/1573/B], my solution which is of O(n log n) time complexity is not working and giving a tle on test 2, when clearly the problem allows O(n log n) to pass. My solution: [submission:https://codeforces.net/contest/1573/submission/240104987]. Can somebody explain why this is happening. I know that there is a better solution in the editorial but why should this not pass?

Update: Fixed the problem :>

Full text and comments »

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