arknave's blog

By arknave, history, 2 months ago, In English

Because it's fun :)

Inspired by SecondThread's comment above, I thought I'd see how hard it would be to solve a Meta Hacker Cup problem at compile time. I chose to start with Round 2 A1, since the input is quite small. This is probably trivial since C++20 and above allow you to allocate memory in constexpr functions, so I gave it a whirl using C++17. This means no allocations are allowed, but the input/output parsing is luckily very straightforward for this problem.

The code is a bit long (118 lines), so I've included it in the link below. It appears to work on the three major compilers: https://godbolt.org/z/cYG1rTfWr (v1) https://godbolt.org/z/3GdPKxrcj (v2).

Note that the compiled binary returns a random value, To actually view the answer, you can view the compiled binary in a hex editor, or do what I did:

$ strings a.out | grep Case
Case #1: 1
Case #2: 4
Case #3: 10
Case #4: 1
Case #5: 1
Case #6: 0

This code is also sufficient to pass the full data set (136 cases) without running into the default constexpr-ops limit. On my 2,3GHz Intel i5 laptop CPU from 2018, clang compiles the full data set in .5 seconds.

Does anyone know a nicer way of ensuring that ANS is not discarded by the compiler for not being used? EDIT: Thanks to EnDeRBeaT for the volatile recommendation, this is much simpler.

Full text and comments »

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

By arknave, history, 5 years ago, In English

Run the following code in the custom invocation tab with pypy3.6

import random

print('Hello world!')

This gives the following verdict:

Runtime error: exit code is 13131313
=====
Used: 373 ms, 10900 KB

Any ideas why? This also happens with pypy2.7, but not when using the CPython interpreters.

Full text and comments »

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

By arknave, history, 5 years ago, In English

The 2019 North American Qualifier (NAQ) will be held tomorrow. The NAQ is an online, pre-regional programming contest to help coaches choose teams for regional competitions (or serve as practice). The contest begins at 2019-10-05 18:00 UTC. Official participants who have already registered can access the problems at https://naq19.kattis.com/.

There is also a slightly delayed open mirror where anyone can compete. The open mirror begins fifteen minutes after the official contest, and is available here: https://open.kattis.com/contests/naq19open.

More details here: http://cs.baylor.edu/~hamerly/icpc/qualifier_2019/. Past versions: 2018, 2017.

Good luck to all competing!

EDIT: Contest is over, congratulations to all the teams that competed! Some statistics and solution outlines available here: https://cs.baylor.edu/~hamerly/icpc/qualifier_2019/

Full text and comments »

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

By arknave, history, 6 years ago, In English

The 2018 South Central USA (SCUSA) ACM-ICPC Regional Contest is tomorrow, Saturday November 10rd, 6pm UTC. There is an open division for anyone interested in competing at: https://open.kattis.com/contests/scusa18open. The official scoreboard will be at https://scusa18.kattis.com/. Good luck to all competitors!

There is no way to request or issue clarifications in the open division of Kattis, please comment here if any questions arise.

The problem set was created by myself, Greg Hamerly, Etienne Vouga, and Rob Hochberg. Thanks to xiaowuc1 for inspiration.

Also thanks to brycesandlund because I copied his NCNA announcement.

EDIT: Contest delayed by 15 minutes. Will start in 10 minutes. Good luck!

Full text and comments »

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