Compile Time Computation?

Правка en1, от Syrian, 2025-05-19 18:24:07

Not sure if any blogs have been written on this recently. I found one from 10ish years ago.

Codeforces [GCC 14] compiler allows you to perform 33,554,432 operations during compile time. This is pretty small, with respect to normal time limits, but its still interesting to question whether or not it can be used to boost some solutions.

Heres an attempt to cheese a CSES problem with a solution which performs large matrix multiplications: https://cses.fi/paste/1052a83da5315cb7c5d15b/

There is an implementation of the solution mentioned above which passes CSES constraints but without compile time computations and heavily optimized.

My goal was to perform as many multiplications as possible during compilation and my results were:

  • CSES: 0 multiplications (they set a tight limit on the output file's size apparently)
  • Codeforces (custom invocation): 0 multiplication (but it let me construct and fill the base matrix)

Of course, these results can be predicted with basic math... after I was aware of the 33,554,432 limit.

This is probably a bad algorithm to test on (_or maybe bad constraints_). Anyways, can you think of ways to use this feature?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Syrian 2025-05-19 18:29:32 93
en1 Английский Syrian 2025-05-19 18:24:07 1220 Initial revision (published)