专栏文章

[obsolete] kenkoooo atcoder patch

个人记录参与者 1已保存评论 0

文章操作

快速查看文章及其快照的属性,并进行相关操作。

当前评论
0 条
当前快照
1 份
快照标识符
@mipqyybq
此快照首次捕获于
2025/12/03 16:30
3 个月前
此快照最后确认于
2025/12/03 16:30
3 个月前
查看原文
CPP
// ==UserScript==
// @name         Add Table Success Class
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add table-success class to specified table cells
// @author       BreakPlus
// @match        https://kenkoooo.com/atcoder/*
// ==/UserScript==

(function() {
    'use strict';

    function highlightTableCells(url) {
        var sp = url.length-1;
        if(sp < 5) return;
        if(/^\d$/.test(url[sp])) sp-=1;
        const mapping = {
            'A': 1,
            'B': 2,
            'C': 3,
            'D': 4,
            'E': 5,
            'F': 6,
            'F2': 7,
            'G': 7,
            'H': 8
        };
        const contest = url.substr(0,sp).toUpperCase();
        const problem = mapping[url.substr(sp).toUpperCase()];
        const tds = document.querySelectorAll('td');
        let found = false;

        tds.forEach((td, index) => {
            if (td.textContent.includes(contest)) {
                tds[index + problem].classList.add('table-success');
            }
        });
    }

    const problem_list_str=
    `
    agc071a
    agc071b
    agc071c
    agc071d
    agc051c
    abc399g
    agc009d
    agc009e
    arc195d
    arc195e
    arc160f
    arc127f
    arc126f
    agc038f
    agc031e
    agc008e
    agc008f
    agc007c
    `;
    const problem_list=problem_list_str.split('\n');

    function process(){
        for(var problem of problem_list) {
            highlightTableCells(problem.trim());
        }
    }

    setInterval(process,1000);
})();

评论

0 条评论,欢迎与作者交流。

正在加载评论...