Python 3 can do bitsets too

Revision en1, by jzhe727, 2023-10-28 08:28:42

Python 3 has unlimited size integers, which can function as dynamic size bitsets when doing bitwise operations. Python is still about 3x slower than C++ bitsets with no pragmas and 10x slower than C++ with avx2+O3 pragmas. However, the Python integers have dynamic size, so there some potential of making a problem that requires dynamic bitsets purely to mess with people who use C++ standard library bitsets.

Anyways, here's some simple code I wrote in Python for https://ecna22.kattis.com/problems/amusicalquestion. It is AC in 0.16s.

Code
Tags bitset, python3

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English jzhe727 2023-10-28 08:28:42 1333 Initial revision (published)