From 8ba2a598fef2fd964460f630579ebb65078e29f8 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 25 Oct 2025 00:34:32 -0400 Subject: [PATCH] fix(tests): refactor fixture directory --- tests/conftest.py | 18 +- tests/fixtures/codechef_P2209.html | 5754 --------------- tests/fixtures/codechef_P3209.html | 5101 -------------- tests/fixtures/codechef_P4209.html | 5940 ---------------- tests/fixtures/codechef_P5209.html | 6175 ----------------- tests/fixtures/codechef_START209D_P2209.json | 85 - tests/fixtures/codechef_START209D_P3209.json | 85 - tests/fixtures/codechef_START209D_P4209.json | 85 - tests/fixtures/codechef_START209D_P5209.json | 85 - .../atcoder}/atcoder_abc100_tasks.html | 0 .../fixtures/atcoder}/atcoder_contests.html | 0 .../atcoder}/atcoder_task_abc100_a.html | 0 .../atcoder}/atcoder_task_abc100_b.html | 0 .../atcoder}/atcoder_task_abc100_c.html | 0 .../atcoder}/atcoder_task_abc100_d.html | 0 .../fixtures/codechef}/codechef_P1209.html | 0 .../codechef}/codechef_START209D.json | 0 .../codechef}/codechef_START209D_P1209.json | 0 .../fixtures/codechef}/codechef_contests.json | 0 .../codeforces}/codeforces_1550_A.html | 0 .../codeforces}/codeforces_1550_B.html | 0 .../codeforces}/codeforces_1550_problems.html | 0 .../codeforces}/codeforces_contests.html | 0 .../fixtures/cses}/cses_contests.html | 0 .../fixtures/cses}/cses_task_1068.html | 0 .../fixtures/cses}/cses_task_1621.html | 0 26 files changed, 9 insertions(+), 23319 deletions(-) delete mode 100644 tests/fixtures/codechef_P2209.html delete mode 100644 tests/fixtures/codechef_P3209.html delete mode 100644 tests/fixtures/codechef_P4209.html delete mode 100644 tests/fixtures/codechef_P5209.html delete mode 100644 tests/fixtures/codechef_START209D_P2209.json delete mode 100644 tests/fixtures/codechef_START209D_P3209.json delete mode 100644 tests/fixtures/codechef_START209D_P4209.json delete mode 100644 tests/fixtures/codechef_START209D_P5209.json rename tests/fixtures/{ => tests/fixtures/atcoder}/atcoder_abc100_tasks.html (100%) rename tests/fixtures/{ => tests/fixtures/atcoder}/atcoder_contests.html (100%) rename tests/fixtures/{ => tests/fixtures/atcoder}/atcoder_task_abc100_a.html (100%) rename tests/fixtures/{ => tests/fixtures/atcoder}/atcoder_task_abc100_b.html (100%) rename tests/fixtures/{ => tests/fixtures/atcoder}/atcoder_task_abc100_c.html (100%) rename tests/fixtures/{ => tests/fixtures/atcoder}/atcoder_task_abc100_d.html (100%) rename tests/fixtures/{ => tests/fixtures/codechef}/codechef_P1209.html (100%) rename tests/fixtures/{ => tests/fixtures/codechef}/codechef_START209D.json (100%) rename tests/fixtures/{ => tests/fixtures/codechef}/codechef_START209D_P1209.json (100%) rename tests/fixtures/{ => tests/fixtures/codechef}/codechef_contests.json (100%) rename tests/fixtures/{ => tests/fixtures/codeforces}/codeforces_1550_A.html (100%) rename tests/fixtures/{ => tests/fixtures/codeforces}/codeforces_1550_B.html (100%) rename tests/fixtures/{ => tests/fixtures/codeforces}/codeforces_1550_problems.html (100%) rename tests/fixtures/{ => tests/fixtures/codeforces}/codeforces_contests.html (100%) rename tests/fixtures/{ => tests/fixtures/cses}/cses_contests.html (100%) rename tests/fixtures/{ => tests/fixtures/cses}/cses_task_1068.html (100%) rename tests/fixtures/{ => tests/fixtures/cses}/cses_task_1621.html (100%) 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 @@ - - - - - - - - - - - - - - - Divisible Duel Practice Coding Problem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-
-
-
-
-
-
-
- Difficulty:628 -
-
- -
-
- Expand -
-
- -
-
-
-
-
-
-
-
-
-
- -
- -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- Learn the building blocks of programming - languages -
-
-
- Take our free programming courses and learn to - solve problems like these. -
- Start Learning -
-
-

Divisible Duel

-

- Alice loves working with numbers. One day, she - takes two integers - XX - and - YY - (YXY \ge X) and becomes curious about the numbers - between them. -

-

- She looks at all integers between - XX - and - YY - (inclusive) that are divisible by - XX.
- Among these numbers, she separates them into - even and odd numbers. -

-

- Let the sum of all even numbers Alice has be - SevenS_{even}, and the sum of all odd numbers she has be - SoddS_{odd}. -

-

- If - SevenSoddS_{even} \ge S_{odd}, Alice will be happy; otherwise, she will be - sad.
- Alice wants to know whether she will be happy - or not. -

-
-

Input Format

-
    -
  • - The first line contains a single integer - TT - — the number of test cases. -
  • -
  • - Each of the next - TT - lines contains two integers - XX - and - YY, representing the lower and upper bound - of integers Alice looked at. -
  • -
-
-
-

Output Format

-

- 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). -

-
-

Constraints

-
-
    -
  • - 1T1041 \leq T \leq - 10^4 -
  • -
  • - 1X,Y1001 \leq X,Y \leq - 100 -
  • -
-
-

Sample 1:

-
-
-
- Input -
- -
-
-
- Output -
- -
-
-
-
-
-
-3
-1 4
-3 9
-4 100
-
-
-
-
-YES
-NO
-YES
-
-
-
-

Explanation:

-
-

- Test case - 11: - Alice has - X=1X = 1 - and - Y=4Y = 4.
- The multiples of - XX - in this range are - 1,2,3,41, 2, 3, 4.
- So, - Seven=2+4=6S_{even} = 2+4 = 6, and - Sodd=1+3=4S_{odd} = 1+3 = 4.
- Since - SevenSoddS_{even} \ge - S_{odd}, Alice is happy. -

-

- Test case - 22: - Alice has - X=3X = 3 - and - Y=9Y = 9.
- The multiples of - XX - in this range are - 3,6,93, 6, 9. So, - Seven=6S_{even} = 6, and - Sodd=3+9=12S_{odd} = 3+9 = 12.
- Since - Seven<SoddS_{even} \lt - S_{odd}, Alice is not happy. -

-
-
-
-
-
-
-
-
- More Info -
-
-
- Time limit1 secs -
-
- Memory limit1.5 GB -
-
- Source Limit50000 Bytes -
-
-
-
-
-
-
-

- -

-
-
-
-
-
-
- Author(s) - -
-
- Tester(s) -
- kingmessi -
-
-
- Editorialist(s) - -
-
-
-
-
-
-
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
- - - -
-
-
-
    -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
-
-
- -
- - -
-
-
- -
-
-
-
-
-
-
- #include - <bits/stdc++.h> -
-
-
-
- using - namespace - std; -
-
-
-
-
-
-
- int - main() - { -
-
-
-
- // your code goes here -
-
-
-
-
-
-
- } -
-
-
-
-
-
-
-
-
-
-
-
-
-
-   -
-
-
-
-   -
-
-
-
- הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה -
-
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -
-
- -
-
-
-
-
-
-
-
-

- -

-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Visualize Code -
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - - -
- - -
-
- -
- - diff --git a/tests/fixtures/codechef_P3209.html b/tests/fixtures/codechef_P3209.html deleted file mode 100644 index 15fb3a4..0000000 --- a/tests/fixtures/codechef_P3209.html +++ /dev/null @@ -1,5101 +0,0 @@ - - - - - - - - - - - - - - - Small GCD Sort Practice Coding Problem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-
-
-
-
-
-
-
- Difficulty:1039 -
-
- -
-
- Expand -
-
- -
-
-
-
-
-
-
-
-
-
- -
- -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- Learn the building blocks of programming - languages -
-
-
- Take our free programming courses and learn to - solve problems like these. -
- Start Learning -
-
-

Small GCD Sort

-

- There are - NN - players, numbered from - 11 - to - NN. -

-

- Player - ii's score is defined to be - gcd(i,N)\gcd(i, N).
- Here, - gcd(i,N)\gcd(i, N) - refers to the largest positive integer that - divides both - ii - and - NN. -

-

- Your task is to find an ordering of the - players, from left to right, that satisfies - the following conditions: -

-
    -
  • - Between two players with different scores, - the one with a higher score must appear - somewhere to the left of the one with a - lower score. -
  • -
  • - Between two players with the same score, the - player with a smaller number must appear - somewhere to the left of the one with a - lower score. -
  • -
-

- It can be proved that these rules uniquely - define an ordering of the - NN - people.
- Your task is to find this ordering. -

-
-

Input Format

-
    -
  • - The first line contains a single integer - TT - — the number of test cases. -
  • -
  • - Each of the next - TT - lines contains a single integer - NN - — the number of players. -
  • -
-
-
-

Output Format

-

- For each test case, print - NN - space-separated integers on a new line — the - player numbers in the required preference - order. -

-
-

Constraints

-
-
    -
  • - 1T1001 \leq T \leq 100 -
  • -
  • - 1N1001 \leq N \leq 100 -
  • -
-
-

Sample 1:

-
-
-
- Input -
- -
-
-
- Output -
- -
-
-
-
-
-
-5
-1
-2
-3
-4
-5
-
-
-
-1
-2 1
-3 1 2
-4 2 1 3
-5 1 2 3 4
-
-
-
-

Explanation:

-
-

- Test case - 11: - There is only one player. -

-

- Test case - 22: - There are two players.
- Player - 11 - has a score of - gcd(1,2)=1\gcd(1, 2) = 1, while player - 22 - has a score of - gcd(2,2)=2\gcd(2, 2) = 2.
- Player - 22 - has a higher score, and so appears to the - left of player - 11, making the only possible order - [2,1][2, 1]. -

-

- Test case - 44: - There are four players. It can be verified - that players - 11 - and - 33 - have a score of - 11, player - 22 - has a score of - 22, and player - 44 - has a score of - 44.
- So, -

-
    -
  • - Player - 44 - has the highest score, and so must be - placed first. -
  • -
  • - Player - 22 - has the second highest score, and so must - be placed second. -
  • -
  • - Players - 11 - and - 33 - have the same score.
    - Among them, - 11 - has the smaller number, and so must be - placed ahead of - 33. -
  • -
-

- Thus, the final order is - [4,2,1,3][4, 2, 1, 3]. -

-
-
-
-
-
-
-
-
- More Info -
-
-
- Time limit1 secs -
-
- Memory limit1.5 GB -
-
- Source Limit50000 Bytes -
-
-
-
-
-
-
-

- -

-
-
-
-
-
-
- Author(s) - -
-
- Tester(s) -
- kingmessi -
-
-
- Editorialist(s) - -
-
-
-
-
-
-
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
- - - -
-
-
-
    -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
-
-
- -
- - -
-
-
- -
-
-
-
-
-
-
- #include - <bits/stdc++.h> -
-
-
-
- using - namespace - std; -
-
-
-
-
-
-
- int - main() - { -
-
-
-
- // your code goes here -
-
-
-
-
-
-
- } -
-
-
-
-
-
-
-
-
-
-
-
-
-
-   -
-
-
-
-   -
-
-
-
- הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה -
-
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -
-
- -
-
-
-
-
-
-
-
-

- -

-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Visualize Code -
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - - -
- -
- -
- -
- - diff --git a/tests/fixtures/codechef_P4209.html b/tests/fixtures/codechef_P4209.html deleted file mode 100644 index 554a3c3..0000000 --- a/tests/fixtures/codechef_P4209.html +++ /dev/null @@ -1,5940 +0,0 @@ - - - - - - - - - - - - - - - Tactical Conversion Practice Coding Problem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-
-
-
-
-
-
-
- Difficulty:1626 -
-
- -
-
- Expand -
-
- -
-
-
-
-
-
-
-
-
-
- -
- -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- Learn the building blocks of programming - languages -
-
-
- Take our free programming courses and learn to - solve problems like these. -
- Start Learning -
-
-

Tactical Conversion

-

- You are given a binary string - SS - of length - NN, i.e. each character of - SS - is either - 00 - or - 11. -

-

- You would like to convert every character of - SS - into - 00.
- To achieve this, you can perform the following - operation: -

-
    -
  • - Choose an index - ii - (1iN)(1 \le i \le N) - such that - Si=1S_i = 1, and change - SiS_i - to - 00. -
  • -
-

- However, there is one restriction:
- You cannot perform two consecutive operations - on adjacent indices.
- That is, if you operate on the sequence of - indices - i1,i2,,iki_1, i_2, \ldots, i_k, then for each - 1j<k1 \le j \lt k - the condition - ijij+1>1|i_j - i_{j+1}| \gt 1 - must hold. -

-

- Determine whether it is possible to make the - entire string consist of only zeros under - these conditions. -

-
-

Input Format

-
    -
  • - The first line of input contains a single - integer - TT, denoting the number of test cases. -
  • -
  • - Each test case consists of two lines of - input: -
      -
    • - The first line contains a single - integer - NN - — the length of the binary string. -
    • -
    • - The second line contains the binary - string - SS - of length - NN, consisting only of characters - 0 and 1. -
    • -
    -
  • -
-
-
-

Output Format

-

- 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). -

-
-

Constraints

-
-
    -
  • - 1T21051 \leq T \leq 2\cdot - 10^5 -
  • -
  • - 1N21051 \leq N \leq 2\cdot - 10^5 -
  • -
  • - SS - is a binary string. -
  • -
  • - The sum of - NN - over all test cases won't exceed - 21052\cdot 10^5. -
  • -
-
-

Sample 1:

-
-
-
- Input -
- -
-
-
- Output -
- -
-
-
-
-
-
-5
-2
-00
-3
-001
-3
-101
-3
-111
-2
-11
-
-
-
-
-Yes
-Yes
-Yes
-No
-No
-
-
-
-

Explanation:

-
-

- Test case - 11: - No operations are needed. -

-

- Test case - 22: - There is a single - 11 - at position - 33.
- Simply perform one operation with - i=3i = 3, and the string becomes - 000000 - as desired. -

-

- Test case - 33: - There are two - 11's, at positions - 11 - and - 33.
- Perform one operation with - i=1i = 1, and the next operation with - i=3i = 3, and we're done. -

-

- Test case - 44: - There are three ones, at positions - 1,2,31, 2, 3.
- It's not possible to operate on all of them, - because: -

-
    -
  • - If our first operation is on index - 11, the second operation cannot be index - 22 - and so must be index - 33.
    - But then after index - 33 - we cannot operate on index - 22 - anyway, so that index will continue to - contain a - 11. -
  • -
  • - Similarly, the first operation being on - index - 33 - will leave us unable to operate on index - 22. -
  • -
  • - Finally, if the first operation is on - index - 22, then the second operation cannot be on - either index - 11 - or index - 33 - since they're both adjacent to it. -
  • -
-

- Thus, there's no way to make everything - 00. -

-
-
-
-
-
-
-
-
- More Info -
-
-
- Time limit1 secs -
-
- Memory limit1.5 GB -
-
- Source Limit50000 Bytes -
-
-
-
-
-
-
-

- -

-
-
-
-
-
-
- Author(s) - -
-
- Tester(s) -
- kingmessi -
-
-
- Editorialist(s) - -
-
-
-
-
-
-
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
- - - -
-
-
-
    -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
-
-
- -
- - -
-
-
- -
-
-
-
-
-
-
- #include - <bits/stdc++.h> -
-
-
-
- using - namespace - std; -
-
-
-
-
-
-
- int - main() - { -
-
-
-
- // your code goes here -
-
-
-
-
-
-
- } -
-
-
-
-
-
-
-
-
-
-
-
-
-
-   -
-
-
-
-   -
-
-
-
- הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה -
-
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -
-
- -
-
-
-
-
-
-
-
-

- -

-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Visualize Code -
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - - -
- - -
-
- -
- - diff --git a/tests/fixtures/codechef_P5209.html b/tests/fixtures/codechef_P5209.html deleted file mode 100644 index a7b7aa9..0000000 --- a/tests/fixtures/codechef_P5209.html +++ /dev/null @@ -1,6175 +0,0 @@ - - - - - - - - - - - - - - - Binary Love Practice Coding Problem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-
-
-
-
-
-
-
- Difficulty:1536 -
-
- -
-
- Expand -
-
- -
-
-
-
-
-
-
-
-
-
- -
- -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- Learn the building blocks of programming - languages -
-
-
- Take our free programming courses and learn to - solve problems like these. -
- Start Learning -
-
-

Binary Love

-

- Alice and Bob are playing a game on a binary - string - SS - of length - NN. -

-

- Alice wants to make the number of substrings - 01 and 10 equal, and - both counts must be non-zero.
- Formally, let - c01c_{01} - denote the number of indices - ii - (1i<N1 \le i \lt N) such that - Si=0S_i = 0 - and - Si+1=1S_{i+1} = 1, and similarly let - c10c_{10} - denote the number of indices - ii - (1i<N1 \le i \lt N) such that - Si=1S_i = 1 - and - Si+1=0S_{i+1} = 0.
- Alice would like for - c01=c10c_{01} = c_{10} - and - c01>0c_{01} \gt 0 - 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 (c01=c10>0c_{01} = c_{10} \gt 0) 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. -

-
-

Input Format

-
    -
  • - The first line of input contains a single - integer - TT, denoting the number of test cases. -
  • -
  • - Each test case consists of two lines of - input: -
      -
    • - The first line contains a single - integer - NN - — the length of the binary string. -
    • -
    • - The second line contains the binary - string - SS - of length - NN, consisting only of characters - 0 and 1. -
    • -
    -
  • -
-
-
-

Output Format

-

- 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). -

-
-

Constraints

-
-
    -
  • - 1T21051 \leq T \leq 2\cdot - 10^5 -
  • -
  • - 1N21051 \leq N \leq 2\cdot - 10^5 -
  • -
  • - Si{0,1}S_i \in \{0, 1\} -
  • -
  • - The sum of - NN - over all test cases won't exceed - 21052\cdot10^5. -
  • -
-
-

Sample 1:

-
-
-
- Input -
- -
-
-
- Output -
- -
-
-
-
-
-
-4
-3
-000
-3
-010
-4
-0001
-4
-0101
-
-
-
-Bob
-Alice
-Bob
-Alice
-
-
-
-

Explanation:

-
-

- Test case - 11: - We have - c01=c10=0c_{01} = c_{10} = 0 - for the initial string.
- No matter what the players do in terms of - deleting characters, this won't change.
- Alice wants - c01>0c_{01} \gt 0, so she cannot win here. -

-

- Test case - 22: - We have - c01=c10=1c_{01} = c_{10} = 1 - initially.
- Alice's condition is already satisfied, so - she wins immediately. -

-

- Test case - 44: - We have - S=0101S = 0101, for which - c01=2c_{01} = 2 - and - c10=1c_{10} = 1.
- Alice must make a move; she can delete the - last character to make - S=010S = 010 - which as seen earlier satisfies Alice's - condition; so Alice wins. -

-
-
-
-
-
-
-
-
- More Info -
-
-
- Time limit1 secs -
-
- Memory limit1.5 GB -
-
- Source Limit50000 Bytes -
-
-
-
-
-
-
-

- -

-
-
-
-
-
-
- Author(s) - -
-
- Tester(s) -
- kingmessi -
-
-
- Editorialist(s) - -
-
-
-
-
-
-
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
- - - -
-
-
-
    -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
  • -
    - -
    -
  • -
-
-
- -
- - -
-
-
- -
-
-
-
-
-
-
- #include - <bits/stdc++.h> -
-
-
-
- using - namespace - std; -
-
-
-
-
-
-
- int - main() - { -
-
-
-
- // your code goes here -
-
-
-
-
-
-
- } -
-
-
-
-
-
-
-
-
-
-
-
-
-
-   -
-
-
-
-   -
-
-
-
- הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה -
-
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -
-
- -
-
-
-
-
-
-
-
-

- -

-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Visualize Code -
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - - -
- -
- -
- -
- - diff --git a/tests/fixtures/codechef_START209D_P2209.json b/tests/fixtures/codechef_START209D_P2209.json deleted file mode 100644 index f041b64..0000000 --- a/tests/fixtures/codechef_START209D_P2209.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "category_name": "main", - "contest_code": "START209D", - "contest_name": "Starters 209 (Rated)", - "status": "success", - "submit_error": "You need to login to submit.", - "is_verified": false, - "problem_code": "P2209", - "contest_category": "9", - "problem_name": "Divisible Duel", - "intended_contest_code": "START209", - "body": "This is an example problem statement in markdown, and a mini guide on writing statements. Please make sure to remove everything here before publishing your problem.\n\n- Codechef uses markdown for its problem statements. Markdown syntax can be found [here](https:\/\/github.com\/showdownjs\/showdown\/wiki\/Showdown's-Markdown-syntax). Note the `[text](link)` syntax to insert a hyperlink.\n- Codechef also uses $\\LaTeX$ to render mathematical expressions, and you are advised to make liberal use of it to make your statement look good.\n- Text can be made **bold** or *italicized*.\n- **Do not** use HTML tags (p, ul, li, pre, br, ...) in the statement.\n- To insert an image, first upload it to an online hosting service (for an official contest, ask a Codechef admin to do this for you \u2014 this is important) and then use the following syntax: `![alt text](link-to-image)`.\n- If your problem doesn't contain subtasks, ensure that the Subtasks section below is disabled and **all content is deleted from it**.\n\nIf you face any issues, either contact a Codechef admin directly or send us an email at help@codechef.com.\n\nBelow is an example problem statement that uses some of the above-mentioned features.\n\n---------\n\nChef has a simple undirected graph $G$ with $N$ vertices and $M$ edges. A [subgraph](https:\/\/mathworld.wolfram.com\/Subgraph.html) $H$ of $G$ is called *good* if:\n- $H$ is connected\n- $H$ contains all $N$ vertices of $G$\n- There is a unique path between any two vertices in $H$, using only edges in $H$\n\nCount the number of *good* subgraphs of $G$. Since this number might be large, report it modulo $10^9 + 7$.\n\nIn other news, here's a completely unrelated image:\n\n![](https:\/\/s3.amazonaws.com\/codechef_shared\/download\/Images\/START41\/ss3.png).\n\n\n