gamma's blog

By gamma, 8 months ago, In English

I was initially a bit stuck with this problem (A. Mr. Kitayuta, the Treasure Hunter), as I kept getting MLE with my approximately $$$9*10^8$$$ integer array, but there's nothing a little bit of memory collection couldn't fix, solving the problem through a method which the authors claimed to have prevented in the editorial :D. So I had quite a bit of a laugh whilst reading it. The last time I used short has got to be years ago.

Full text and comments »

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

By gamma, history, 16 months ago, In English

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!

Full text and comments »

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