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

Автор TheEccentricDuck, история, 3 часа назад, По-английски

Hi guys,

I just looked at the tutorial for this problem: https://mirror.codeforces.com/contest/1982/problem/D. I got all the steps correct (constructing a 2D prefix sum, finding the differences in the submatrices), but I was unable to see how to quickly determine a solution after this. In the tutorial, it states that it is sufficient to say that a solution exists if

$$$D \mod gcd(d_{1},d_{2},...,d_{q})=0$$$

where d[i] is the difference between capped and non-capped mountains in a k*k submatrix, and D is the difference of the total heights of capped and non-capped mountains; however, I cannot see why this is true. Could someone please help me by explaining a proof of this statement? Thank you very much everyone!

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

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

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

Hi guys,

As we all know, fast I/O in competitive programming is very important in speeding up our program runtime. For us C++ users, most of us will know well ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr), or instead of that, we just use scanf or printf instead.

I tried to find a library that's as functional as cout/cin and scanf/printf whilst being significantly faster and I think I found the solution: https://github.com/emeraldacoustics/fast-io. I have been using this library for quite some time now, and I think it is delivering some very nice results. I basically added the header file as template code.

The only downside is that it doesn't support dealing with strings, so we'll have to use char arrays instead. Giving it custom input is also a bit wonky, instead of entering the test input through stdin, you have to pipe it into stdin through a file, otherwise it won't run properly.

Hope you guys find this useful!

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

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

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

Hi guys, right now I think the colours for the tourist title is a bit boring. What do you guys think about a rainbow name? Wouldn't that be fun!

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

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