Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

simonlindholm's blog

By simonlindholm, history, 9 months ago, In English

The European Girls' Olympiad in Informatics 2023 took place from 15th to 21st of July in Lund, Sweden. The results can be found here: https://egoi23.se/scoreboard/. Huge congratulations prvocislo for winning the contest and all other contestants who did incredibly well.

The tasks where authored by snowysecret, Pajaraja, MladenP, bestial-42-centroids, nigus, 4fecta and dj3500.

The problem where prepared by the scientific committee consisting of Cupcakess, nigus, simonlindholm, Xylofo, zehnsechs, deadkey and dj3500.

We also thank our testers: Petr, Eliden, Cauchico, Gullesnuffs and VladGavrila.

An online mirror is available with flexible start time on Kattis running until July 24.

The problems can also be found individually on Open Kattis or on the EGOI23 website. You are welcome to discuss the problems in the comments!

The difficulty ranges between Div2 C and Div1 F, and we are very happy about the quality of the problems.

We are looking forward to seeing you at EGOI 2024 in Eindhoven, the Netherlands.

Full text and comments »

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

By simonlindholm, history, 20 months ago, In English

The finals of Swedish Coding Cup took place recently. Results. Congrats to dukati8 for winning!

The problems are also available on Open Kattis; I think they are kinda nice. (Bonus problem: solve E in O(N + M) time with two monsters.)

Full text and comments »

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

By simonlindholm, history, 3 years ago, In English

Last weekend the finals of Swedish Coding Cup took place. Results. Congrats to _h_ for winning!

The problems are available on Open Kattis; I think they are quite nice.

Full text and comments »

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

By simonlindholm, history, 4 years ago, In English

I wrote an article/blog about how to do fast modular multiplication:

https://simonlindholm.github.io/files/bincoef.pdf

tl;dr:

  • avoid latency-bound loops
  • dynamic modulus is slow, constant modulus is fast
  • if you perform many multiplications with the same dynamic modulus, you can do what the compiler does and use Barrett reduction (involves some precomputation)
  • it is actually possible to beat the compiler if you accept a result in [0, 2*MOD):
uint64_t reduce(uint64_t a) {
  return a - (uint64_t)((__uint128_t(-1ULL / MOD) * a) >> 64) * MOD;
}

Same goes for addition and subtraction: if you can live with a result in [0, 2*MOD), just do a + b or a - b + MOD and skip the range correction that brings the result into [0, MOD). Delay modular reductions far as possible, ideally combining them with multiplications. While being mindful of overflows, of course.

  • on 32-bit, use Montgomery multiplication instead, to avoid __uint128_t
  • if really desperate, combine Montgomery multiplication with SIMD; this runs 3x faster than Barrett reduction when AVX2 is available
  • for larger numbers (e.g. multiplication of 64-bit numbers), use floating-point based methods

Full text and comments »

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

By simonlindholm, history, 5 years ago, In English

Hot on the heels of Finland's contest, the Swedish olympiad finals also took place this weekend, and for those who want to try out the problems, we have put up a site where you can participate during any 5 hour period during this week: https://pofinal19-open.kattis.com/.

If you don't have 5 hours to spare you can also look at the problems directly at https://pofinal19.kattis.com/. The last problem is IMO quite neat.

Full text and comments »

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

By simonlindholm, history, 7 years ago, In English

We just made KTH's ICPC team reference document open source. It contains a few nice things that I haven't seen elsewhere:

For people with archaeological interest, we also have our old TRD available, with version control history going back to 2002. (Did you know that in 2003, the ICPC did not have a page limit for TRDs? KTH's was 129 pages pages long, and included four different bigint implementations. At one point it even contained a re-implementation of the STL, since that wasn't necessarily available on all platforms.)

Full text and comments »

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