Блог пользователя prabalsingh24

Автор prabalsingh24, история, 5 лет назад, По-английски

This is the problem https://codeforces.net/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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор prabalsingh24, история, 5 лет назад, По-английски

I used to think printf scanf are faster than cin cout. However in this https://codeforces.net/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://codeforces.net/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

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор prabalsingh24, история, 6 лет назад, По-английски

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://codeforces.net/contest/1167/submission/54526141

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится