AtCoderRecursionLimitWarning

Warn against using DFS without `setrecursionlimit` on Python.

اعتبارا من 25-06-2025. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         AtCoderRecursionLimitWarning
// @namespace    https://github.com/AwashAmityOak
// @version      0.1.0
// @description  Warn against using DFS without `setrecursionlimit` on Python.
// @author       AwashAmityOak
// @license      MIT
// @match        https://atcoder.jp/contests/*/tasks/*
// @match        https://atcoder.jp/contests/*/submit*
// @grant        unsafeWindow
// @copyright    2025 AwashAmityOak (https://github.com/AwashAmityOak)
// ==/UserScript==

(function() {
    'use strict';

    const $ = unsafeWindow.$;

    ace.edit("editor").addEventListener("change", () => {
        const button = $("#submit");

        const lang = $("#select-lang select[name='data.LanguageId']");
        if (lang.find(":selected").text().indexOf("Python") == -1) {
            $(".AtCoderRecursionLimitWarning").remove();
            button.css("backgroundColor", "");
            button.css("borderColor", "");
            return;
        }

        const code = ace.edit("editor").getValue();

        if (code.toLowerCase().indexOf("dfs") != -1 && !/setrecursionlimit/.test(code)) {
            let br = $("<br>");
            let span = $("<span>⚠️Recursion Limit 未設定</span>");
            br.addClass("AtCoderRecursionLimitWarning");
            span.addClass("AtCoderRecursionLimitWarning");

            if (!$("br.AtCoderRecursionLimitWarning").length) button.append(br);
            if (!$("span.AtCoderRecursionLimitWarning").length) button.append(span);

            button.css("backgroundColor", "#cc3333");
            button.css("borderColor", "#cc3333");
        } else {
            $(".AtCoderRecursionLimitWarning").remove();
            button.css("backgroundColor", "");
            button.css("borderColor", "");
        }
    });
})();