cswork / OAOpen practice workspace

ICA-style · 4 levels · ~90 min · no AI

File store

Add, look up and remove → largest files by prefix → user quotas → compression, backup and restore. Four levels; ownership and quotas reach into every later operation.

Score 0 / 4

Build an in-memory file store: class FileStore in src/files.py. Every method takes a timestamp first, an integer that strictly increases from one call to the next. A path is a string compared exactly ("/a", "/a/" and "/A" are three paths); a size is an integer ≥ 0.

MethodReturns
add(timestamp, path, size)True after adding the file; False if the path is taken (nothing changes)
size_of(timestamp, path)the file's size, or None if there is no such file
remove(timestamp, path)the removed file's size, or None if there is no such file

The public tests of this level are tests/test_level1.py; the judge also runs hidden tests. Pass them all to unlock level 2. Leave the later levels' methods in the class: their briefs come with them.

Sign in to run the tests; passing a level unlocks the next.

Opening the project…