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

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

Hello, Codeforces!

Together with Vladosiya, we've added support for the 64-bit g++14 C++23. You can find it under the name GNU G++23 14.2 (64 bit, winlibs).

If you're using Windows, you can easily install it via our minimalistic package manager, PBOX, by running the command pbox install gcc14-64-winlibs.

Thanks to the WinLibs project! We used the distribution from this page: https://winlibs.com/ GCC 14.2.0 (with POSIX threads) + LLVM/Clang/LLD/LLDB 18.1.8 + MinGW-w64 12.0.0 UCRT - release 1, Win64.

Your solutions will be compiled using the following command line: g++ -Wall -Wextra -Wconversion -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++23 program.cpp.

Now you can start using C++23 features!

Please note that support for GNU G++23 14.2 (64 bit, winlibs) is currently experimental. We invite you to join in the testing and experimentation process. Share your thoughts and experiences in the comments!

It seems this distribution experiences performance degradation, which can lead to time limit exceeded verdict in some cases. For now, we don't recommend using it in real contests.

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

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

Cool

»
4 часа назад, # |
  Проголосовать: нравится +14 Проголосовать: не нравится

clang diag when back

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

ha?

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

Finally the wait is over...[Hooray]

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

its perf is really bad, last contest's E1 gave 1800ms in +23, 1600ms in +20 and 1200ms in +17

»
4 часа назад, # |
  Проголосовать: нравится +31 Проголосовать: не нравится

That's great! Thanks a lot!

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

first comment hooray!!! attractors

»
4 часа назад, # |
Rev. 4   Проголосовать: нравится -7 Проголосовать: не нравится

I'd just tried to use new compiler in this submission 277680488, got TLE

but previously absolutely same solution 277680737 (1 char difference to be able to submit it again) gave me AC

MikeMirzayanov please pay attention on it

»
3 часа назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Cant use print :(

»
3 часа назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

Savior-of-Cross bro can finally rest after asking from last 5 months.

»
2 часа назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Oh finally!, it is amazing, thanks a lot!!!

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

Thank you.

std::format will be very useful to make many output statements cleaner for those not using printf style format strings.

Before: std::cout << a << " + " << b << " = " << a+b << '\n';

After: std::cout << std::format("{} + {} = {}\n", a, b, a+b);

»
112 минут назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Quick benchmarking got really weird: an $$$\mathcal{O}(n \log^2{n})$$$ code on 1991C - Absolute Zero used like double runtime in C++23 compared to C++20:

Was it a bug, or was it intended that way...?

Extra: trying to use set in that approach yielded 1500ms for C++20 (TL=2s), and instant TLE for C++23.

  • »
    »
    101 минуту назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Extra #2: The runtime difference is seven-fold for $$$\mathcal{O}(n \log{n})$$$ ? [more precisely, $$$\mathcal{O}(n \log{\left( \max{a_i} - \min{a_i} \right)})$$$ ]

»
89 минут назад, # |
  Проголосовать: нравится +21 Проголосовать: не нравится

As of now, C++23 is not in the best shape, but when GCC will finally implement it, it will go hard.

Mainly for competitive programming, a C++23 gold nugget is std::print.

Finally clunky output with std::cout goes away in favor of elegant:

std::println("The meaning of the {} is {}", "universe" 42); // prints "The meaning of the universe is 42"

"Oh, nice printing, cool" you might think, but it gets better:

std::vector<std::pair<int, std::string>> vec = { {0, "hii"}, {1, "arul"} };
std::print("{}", vec); // prints [(0, "hii"), (1, "arul")]
// or not, they are not implemented yet :p
  • It is faster than std::cout or printf (so maybe fast io hack won't be as used)

Also additional cool things are std::flat_set and std::flat_map that are basically(very roughly speaking) more cache-friendly counterparts of std::set and std::map. Will it be better than std::set and std::map for competitive programming? Time will tell, right now they are not even implemented in GCC.

Also there's deducing this which makes recursive lambdas not as weird (i am a certified lambda glazer, which means that deducing this is epic and cool)

Summarizing, C++23 adds great features for competitive programming. In theory. In reality, GCC 14.2 doesn't implement most features that folks on codeforces would find interesting

»
76 минут назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Amazing! No more cout (=

Thank you very much for the effort put into making c++23 available!

»
3 минуты назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thanks a lot!!!!!