diff --git a/tests/conftest.py b/tests/conftest.py index 5970960..3ac8885 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -63,13 +63,13 @@ def run_scraper_offline(fixture_text): target = target.removeprefix("https://cses.fi") if target.strip("/") == "problemset": - return fixture_text("cses_contests.html") + return fixture_text("cses/cses_contests.html") if target.startswith("/problemset/task/") or target.startswith( "problemset/task/" ): pid = target.rstrip("/").split("/")[-1] - return fixture_text(f"cses_task_{pid}.html") + return fixture_text(f"cses/cses_task_{pid}.html") raise AssertionError(f"No fixture for CSES path={path!r} url={url!r}") @@ -77,12 +77,12 @@ def run_scraper_offline(fixture_text): if not url: raise AssertionError("AtCoder expects url routing") if "/contests/archive" in url: - return fixture_text("atcoder_contests.html") + return fixture_text("atcoder/atcoder_contests.html") if url.endswith("/tasks"): - return fixture_text("atcoder_abc100_tasks.html") + return fixture_text("atcoder/atcoder_abc100_tasks.html") if "/tasks/" in url: slug = url.rsplit("/", 1)[-1] - return fixture_text(f"atcoder_task_{slug}.html") + return fixture_text(f"atcoder/atcoder_task_{slug}.html") raise AssertionError(f"No fixture for AtCoder url={url!r}") def _router_codeforces(*, path: str | None = None, url: str | None = None) -> str: @@ -90,17 +90,17 @@ def run_scraper_offline(fixture_text): raise AssertionError("Codeforces expects url routing") if "/contest/" in url and url.endswith("/problems"): contest_id = url.rstrip("/").split("/")[-2] - return fixture_text(f"codeforces_{contest_id}_problems.html") + return fixture_text(f"codeforces/codeforces_{contest_id}_problems.html") if "/contests" in url and "/problem/" not in url: - return fixture_text("codeforces_contests.html") + return fixture_text("codeforces/codeforces_contests.html") if "/problem/" in url: parts = url.rstrip("/").split("/") contest_id, index = parts[-3], parts[-1] - return fixture_text(f"codeforces_{contest_id}_{index}.html") + return fixture_text(f"codeforces/codeforces_{contest_id}_{index}.html") if "/problemset/problem/" in url: parts = url.rstrip("/").split("/") contest_id, index = parts[-2], parts[-1] - return fixture_text(f"codeforces_{contest_id}_{index}.html") + return fixture_text(f"codeforces/codeforces_{contest_id}_{index}.html") raise AssertionError(f"No fixture for Codeforces url={url!r}") diff --git a/tests/fixtures/codechef_P2209.html b/tests/fixtures/codechef_P2209.html deleted file mode 100644 index 97d86ac..0000000 --- a/tests/fixtures/codechef_P2209.html +++ /dev/null @@ -1,5754 +0,0 @@ - - -
- - - - - - - - - - - -- Alice loves working with numbers. One day, she - takes two integers - - and - - () and becomes curious about the numbers - between them. -
-
- She looks at all integers between
-
- and
-
- (inclusive) that are divisible by
- .
- Among these numbers, she separates them into
- even and odd numbers.
-
- Let the sum of all even numbers Alice has be - , and the sum of all odd numbers she has be - . -
-
- If
- , Alice will be happy; otherwise, she will be
- sad.
- Alice wants to know whether she will be happy
- or not.
-
- For each test case, print the answer on a
- new line: YES if Alice will be
- happy, otherwise NO.
-
- You may print each character of the answer
- in uppercase either or lowercase (for
- example, the strings YES,
- yEs, yes, and
- yeS will all be treated as
- identical).
-
-3 -1 4 -3 9 -4 100 --
-YES -NO -YES-
- Test case
- :
- Alice has
-
- and
- .
- The multiples of
-
- in this range are
- .
- So,
- , and
- .
- Since
- , Alice is happy.
-
- Test case
- :
- Alice has
-
- and
- .
- The multiples of
-
- in this range are
- . So,
- , and
- .
- Since
- , Alice is not happy.
-
- There are - - players, numbered from - - to - . -
-
- Player
- 's score is defined to be
- .
- Here,
-
- refers to the largest positive integer that
- divides both
-
- and
- .
-
- Your task is to find an ordering of the - players, from left to right, that satisfies - the following conditions: -
-
- It can be proved that these rules uniquely
- define an ordering of the
-
- people.
- Your task is to find this ordering.
-
- For each test case, print - - space-separated integers on a new line — the - player numbers in the required preference - order. -
--5 -1 -2 -3 -4 -5-
-1 -2 1 -3 1 2 -4 2 1 3 -5 1 2 3 4-
- Test case - : - There is only one player. -
-
- Test case
- :
- There are two players.
- Player
-
- has a score of
- , while player
-
- has a score of
- .
- Player
-
- has a higher score, and so appears to the
- left of player
- , making the only possible order
- .
-
- Test case
- :
- There are four players. It can be verified
- that players
-
- and
-
- have a score of
- , player
-
- has a score of
- , and player
-
- has a score of
- .
- So,
-
- Thus, the final order is - . -
-- You are given a binary string - - of length - , i.e. each character of - - is either - - or - . -
-
- You would like to convert every character of
-
- into
- .
- To achieve this, you can perform the following
- operation:
-
- However, there is one restriction:
- You cannot perform two consecutive operations
- on adjacent indices.
- That is, if you operate on the sequence of
- indices
- , then for each
-
- the condition
-
- must hold.
-
- Determine whether it is possible to make the - entire string consist of only zeros under - these conditions. -
-0 and 1.
-
- For each test case, output a single string
- on a new line — YES if it is
- possible to convert the entire string to all
- zeros under the given rule, or
- NO otherwise.
-
- You may print each character of the string
- in uppercase or lowercase (for example, the
- strings YES, yEs,
- yes, and yeS will
- all be treated as identical).
-
-5 -2 -00 -3 -001 -3 -101 -3 -111 -2 -11 --
-Yes -Yes -Yes -No -No-
- Test case - : - No operations are needed. -
-
- Test case
- :
- There is a single
-
- at position
- .
- Simply perform one operation with
- , and the string becomes
-
- as desired.
-
- Test case
- :
- There are two
- 's, at positions
-
- and
- .
- Perform one operation with
- , and the next operation with
- , and we're done.
-
- Test case
- :
- There are three ones, at positions
- .
- It's not possible to operate on all of them,
- because:
-
- Thus, there's no way to make everything - . -
-- Alice and Bob are playing a game on a binary - string - - of length - . -
-
- Alice wants to make the number of substrings
- 01 and 10 equal, and
- both counts must be non-zero.
- Formally, let
-
- denote the number of indices
-
- () such that
-
- and
- , and similarly let
-
- denote the number of indices
-
- () such that
-
- and
- .
- Alice would like for
-
- and
-
- to both hold.
-
- Bob, on the other hand, wants to prevent Alice - from achieving this condition. -
-
- The players take turns alternately, with Alice
- going first.
- In each turn, the current player can remove
- exactly one character from either the
- beginning or the end of the string.
-
- The game ends immediately when the string - becomes empty or when Alice's desired - condition () is satisfied. -
-
- If Alice can make the number of
- 01 and 10 substrings
- equal (and both non-zero), she wins.
- Otherwise, if Bob can prevent this condition
- until the string becomes empty, Bob wins.
- In particular, if the initial string satisfies
- the required condition, Alice wins
- immediately, without even having to make a
- move.
-
- Determine the winner of the game if both - players play optimally. -
-0 and 1.
-
- For each test case, output a single string —
- Alice if Alice wins the game,
- or Bob if Bob wins the game.
-
- You may print each character of the string
- in uppercase or lowercase (for example, the
- strings BOB, bOb,
- bob, and boB will
- all be treated as identical).
-
-4 -3 -000 -3 -010 -4 -0001 -4 -0101-
-Bob -Alice -Bob -Alice-
- Test case
- :
- We have
-
- for the initial string.
- No matter what the players do in terms of
- deleting characters, this won't change.
- Alice wants
- , so she cannot win here.
-
- Test case
- :
- We have
-
- initially.
- Alice's condition is already satisfied, so
- she wins immediately.
-
- Test case
- :
- We have
- , for which
-
- and
- .
- Alice must make a move; she can delete the
- last character to make
-
- which as seen earlier satisfies Alice's
- condition; so Alice wins.
-