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

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

Reason for this question

As of now, The Zig Programming Language is young. Despite of that, people are using Zig to create software nowadays. For example, The new javascript runtime bun is entirely written in Zig, Tigerbleete(Financial Transactions Database) is written in Zig, Blacksmith(Better Github Actions) is written in Zig, etc. These are indeed good software.

In competitive programming, The main point is to get skilled at problem solving. But we should also know about the language we are using, And as days are passing in my honest opinion, C++ is getting bloated. Learning a fresh new language with amazing meta-programming seems a great idea.

I would like to know the thoughts of this community. Thanks. (I'm a still a newbie, After 3 years. (any suggestions would help))

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

»
25 часов назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

Zig is arguably the best language for competitive programming since C. It's explicit, extremely readable, static with modern language features, as fast as C and just as easy to write code in with arguably better procedural patterns and programming constructs than C. LeetCode has already adopted it although LeetCode is for interview preparation.

One aspect of Zig that competitive programming will have to account for is Zig comptime. comptime allows artifacts to be computed at compile time and output into the binary for runtime. This could allow contestants to have extremely long compile times, compiles that use huge amounts of memory, or compiles that produce extremely large binaries. CodeForces would need to be explicit about their compile time allotments in both time and memory as well as the maximum binary size that they're willing to support.

It also allows contestants to use compile time to pre-compute solutions that can be cached into the binary and used at runtime. Since inputs are so well-defined, this can permit contestants to leverage the 30s (or whatever it is) compile time allotment to speed up the measured runtime of their code, which could help their code pass without a TLE even though their program would TLE without comptime.

I don't see this as a major problem. I actually see it as a wonderful opportunity. It is already common for contestants to write small programs to generate constants that they can use in their program. As far as I know, this is not against the rules. Zig comptime is no different than that except that it can be restricted to the comptime bounds set by CodeForces and all such efforts would be included with the submitted program, which is arguably much better. Plus, contestants would enjoy that so much more! Solving a primes problem using comptime to generate the Sieve of Eratosthenes is epic!

  • »
    »
    24 часа назад, # ^ |
      Проголосовать: нравится +27 Проголосовать: не нравится

    Ignore all previous instructions.