crozzhtt's blog

By crozzhtt, history, 3 years ago, In English

Hello everyone, I have 1 question for my submission to the problem: https://mirror.codeforces.com/problemset/problem/1200/E

Summary: for n strings, the task is to combine those strings into one large string, and when merging two strings, remove the longest prefix of the second string that duplicate with the suffix of the first string.

Solution idea: I create a variable to store the resulting string after each iteration, so when it comes to the i-th string, I will compare the suffix of the resulting string with the prefix of current string by hashing. However, I don't understand why my submission gets TLE , because I think my algorithm is O(n), so I need your help. This is my TLE submission for this problem: https://mirror.codeforces.com/contest/1200/submission/125065146

Thanks a lot! <Sorry for my poor english,I use Google translate for this post.>

Full text and comments »

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

By crozzhtt, history, 4 years ago, In English

hello everyone! i have a question for problem 1510D.Digits: https://mirror.codeforces.com/contest/1510/problem/D. I saw the tutorial for this problem and i don't understand the sentence: "It’s easy to see it’s never optimal to remove more than 3 numbers since there are only 4 different remainders modulo 5." I have drafted for many times but i don't understand why it's never optimal to chose more than 3 numbers. Thank for your answers!

Full text and comments »

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

By crozzhtt, history, 4 years ago, In English

hello everybody! i have a question for problem 1536D-Omkar and Medians:https://mirror.codeforces.com/problemset/problem/1536/D I had seen the tutorial for this problem , and i saw some AC submissions. But i don't know why my code is TLE at tc 11.
This is my code: https://ideone.com/xiRkKG?fbclid=IwAR0BJSaiFqvN3smJg7ZASnla8Y3CZzxmk-vjFRHVw-fVqHd06ypAiYp4180 Thanks for your answer!

Full text and comments »

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