Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

同時開催ABC/ARCで誤ったテストケースをダウンロードしてしまう #889

Open
Tlapesium opened this issue Aug 14, 2021 · 3 comments

Comments

@Tlapesium
Copy link

Tlapesium commented Aug 14, 2021

Summary / 概要

同時開催ABC/ARC (ARC058 ~ ARC103) のテストケースをダウンロードすると、誤った問題のテストケースをダウンロードしてしまう。

Steps to reproduce / 再現方法

oj download https://atcoder.jp/contests/arc065/tasks/arc065_b --system --dropbox-token=${DROPBOX_TOKEN}
  • version: online-judge-tools 11.4.0 (+ online-judge-api-client 10.9.0)

Expected behavior / 期待される挙動

ARC065の2問目(D問題)のテストケースがダウンロードされる。

Actual behavior / 実際の挙動

ARC065と同時に開催されたABC049のB問題のテストケースがダウンロードされる。

Other notes / その他

  • Will you try to create a pull request?
    • no
@kmyk kmyk added the bug label Aug 15, 2021
@koba-e964
Copy link
Member

https://github.com/online-judge-tools/api-client/blob/v10.10.0/onlinejudge/service/atcoder.py#L823-L829_match_system_cases_contest_folder_match_system_cases_problem_folder を改善すれば直るはずです。 / Improving _match_system_cases_contest_folder and _match_system_cases_problem_folder at https://github.com/online-judge-tools/api-client/blob/v10.10.0/onlinejudge/service/atcoder.py#L823-L829 should fix this issue.

@k1832
Copy link

k1832 commented Oct 23, 2022

ARC065はABC049と同日開催されたので、1問目が"C問題"から始まっています。Dropboxにも/ARC065/C/というパスに1問目のテストケースが格納されているのですが、URLから取得した1問目のproblem_idは"arc065_a"となっています。
つまり"arc065_a" == "C"という関連付けをする必要があるのですが、コンテストの問題の情報はhttps://atcoder.jp/contests/arc065/standings/json のようにJSONで取得できるのでこれを使えば良さそうです。

JSONは以下のような形式になっているので json["TaskInfo"]のリストを走査して関連付けを見つけることができます。

{
    "Fixed": true,
    "AdditionalColumns": null,
    "TaskInfo": [
        {
            "Assignment": "C",
            "TaskName": "白昼夢 / Daydream",
            "TaskScreenName": "arc065_a"
        },
        {
            "Assignment": "D",
            "TaskName": "連結 / Connectivity",
            "TaskScreenName": "arc065_b"
        },
        {
            "Assignment": "E",
            "TaskName": "へんなコンパス / Manhattan Compass",
            "TaskScreenName": "arc065_c"
        },
        {
            "Assignment": "F",
            "TaskName": "シャッフル / Shuffling",
            "TaskScreenName": "arc065_d"
        }
    ], .....

AtCoderProblemクラスにassignmentというメンバを追加して以下の中で関連付けを行うか、
https://github.com/online-judge-tools/api-client/blob/v10.10.0/onlinejudge/service/atcoder.py#L972-L996
assignmentはそれ以外で使わないので(@koba-e964 さんご指摘の通り)以下で関連付けをしても良さそうです。
https://github.com/online-judge-tools/api-client/blob/v10.10.0/onlinejudge/service/atcoder.py#L827-L829

@k1832
Copy link

k1832 commented Oct 23, 2022

今確認したのですが、典型90のような順位表のないコンテストの場合、../standings/jsonの取得ができませんでした。。。
HTMLからassignmentを取得する方法がいいかも知れません。

もしくはAtCoder Problemsが提供するAPIの一つのhttps://kenkoooo.com/atcoder/resources/problems.json を使う方法もあります。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants