prakhar_111's blog

By prakhar_111, 4 years ago, In English

Hello, I was trying to solve this question. I am getting TLE on test 8. What I did is first, I stored the pairs which quarrel in an adjacency list like we store in the graph. Then I sorted the programmers based on their skills in increasing order. Then I iterated one by one from the smallest skill person to the highest skilled programmer and kept storing their skills in multiset. So to find the answer for each, I subtracted the adj[x].size() and the same skilled programmers that have occurred before. I can't understand why I am getting TLE. Can someone please explain the reason? Also, what should I incorporate into my code to solve this problem? I find my approach similar to the tutorial. My submission. I also try to use unordered multiset instead but that too is giving TLE. Link

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By prakhar_111, history, 5 years ago, In English

Hello, I have recently been solving the following question: D. Zero Quantity Maximization It is giving answer as 1 on test case 2. However on almost all online compilers such as Hacker earth, Rextester, Codechef IDE as well as offline ones such as codeblocks, the output is coming as 2 which is correct. I am unable to understand why the codeforces compiler is giving wrong answer. Please can someone point out what's the possible error in my code and why such difference is occurring. Some links to my code on various compilers: Hackerearth Geeks for geeks Thanks in advance.

Full text and comments »

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