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

Автор jerdno, история, 4 года назад, По-английски

Hi,

I'm trying to move from using Java for CP to C++. As such I'm missing some knowledge, but usually I'm able to google it. Today I encountered something that doesn't make sense for me and wasn't able to find good answer for that. In this solution for latest Div 3 contest (problem D) I used unordered_map and received TLE. Then I changed it to map and got Accepted.

I know that what are the differences between map and unordered_map, but I would expect unordered_map to be even faster then map. Does hashing ints really creates so many conflicts, or I'm missing something (for example initialization of size of hash table)?

Thanks.

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

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

Автор jerdno, история, 4 года назад, По-английски

Based on: https://codeforces.com/blog/entry/76555

How is time limit handled on codeforces? Mu solution for problem C had T*N complexity, while solution in editorial had T*N*logN which would not make it in 2 seconds for big enough test set (for example if input would 900 test with string of length 10000 + 100 tests for edge cases). At the end of competition I saw such solution in room, but wasn't quick enough to hack it (with program that would generate 1000 * 10000 test set) and it passed system testing (even though I'm pretty sure that it would take more than 2 seconds). So my question is: is time limit in problem applicable for 1 test, or complete test set?

And to add: are there some limitations for hacking (for example time limit for program that is generating input, or number of characters for directly passing input)? Or did I completely misunderstood hacking and I should provide only 1 single test for input?

Thanks.

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

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