prabalsingh24's blog

By prabalsingh24, history, 5 years ago, In English

This is the problem https://mirror.codeforces.com/contest/1234/problem/D I made segment tree for each alphabet (26) and calculated sum of segments. So if the query is to find distinct character in [l,r] I find sum in [l,r] in each of the 26 segment tree and answer is number of non zero segments. https://ide.codingblocks.com/s/137727 This solution is giving WA in test case#2. However when i swap the line 91 and 92. I get AC. https://ide.codingblocks.com/s/137726 The line 91 and 92 are only the update statement and they are not related to each other. If the query is to change the character in 'pos' index to 'ch', I add 1 to 'pos' index in ch segment tree and change the index at old character segment tree to 0. Why is this happening?

Full text and comments »

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

By prabalsingh24, history, 5 years ago, In English

I used to think printf scanf are faster than cin cout. However in this https://mirror.codeforces.com/contest/914/submission/61405523 i used printf and scanf and got TLE. When i changed it to cin cout and \n I got AC( i used ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) though) https://mirror.codeforces.com/contest/914/submission/61406026. In some cases i found printf scanf to be faster than cin cout( I did not use ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) those times ). Can someone tell me the most efficient way to take I/O

Full text and comments »

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

By prabalsingh24, history, 5 years ago, In English

Someone please help me find error in my code for this probelem. Problem C Educational Round 65. I am getting MLE. Any help would be appreciated. https://mirror.codeforces.com/contest/1167/submission/54526141

Full text and comments »

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