跳到正文

MitchellZhong

744534

https://www.luogu.com.cn/team/61413#main

资料、奖项与版本

资料

编号
744534
抓取

陶片放逐

无权限变更

查看记录

C
ฏ้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้

[最短路复习]555(https://www.luogu.com.cn/paste/q6pqlkx1)

tas

(super)极域

what can I say?

满级质数

MitchellZhong2 https://www.luogu.com.cn/team/108860#main

复制链接到浏览器打开 https://online-video-cutter.com/cn/

https://www.bilibili.com/video/BV1LhXrYEEhU/?spm_id_from=333.337.search-card.all.click

JavaScript
// ==UserScript==
// @name 點擊煙花 - 按住滑鼠持續發射(間隔0.2秒 + 隨滑鼠移動)
// @namespace http://tampermonkey.net/
// @version 2.5
// @description 按住滑鼠左鍵持續發射煙花(0.2秒間隔),發射點隨滑鼠移動,爆炸範圍大、粒子下落緩、粒子50~80
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
    'use strict';
    const canvas = document.createElement('canvas');
    canvas.style.position = 'fixed';
    canvas.style.inset = '0';
    canvas.style.pointerEvents = 'none';
    canvas.style.zIndex = '999999';
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;
    document.body.appendChild(canvas);
    const ctx = canvas.getContext('2d');
    window.addEventListener('resize', () => {
        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;
    });
    const particles = [];
    const rockets = [];
    class Particle {
        constructor(x, y, vx, vy, color, baseHue) {
            this.x = x;
            this.y = y;
            this.vx = vx;
            this.vy = vy;
            this.baseHue = baseHue;
            const hue = baseHue + (Math.random() - 0.5) * 40;
            this.color = `hsl(${hue % 360}, 85%, ${60 + Math.random() * 25}%)`;
            this.alpha = 1;
            this.baseSize = 3.8 + Math.random() * 1.6;
            this.gravity = 0.00 + Math.random() * 0.05;
            this.friction = 0.975;
            this.decay = 0.008 + Math.random() * 0.006;
            this.shapeType = Math.floor(Math.random() * 4);
            this.rotation = Math.random() * Math.PI * 2;
            this.history = [];
            this.maxHistory = 8 + Math.floor(Math.random() * 5);
        }
        update() {
            this.vx *= this.friction;
            this.vy *= this.friction;
            this.vy += this.gravity;
            this.x += this.vx;
            this.y += this.vy;
            this.alpha -= this.decay;
            this.rotation += 0.04;
            if (this.alpha > 0.1) {
                this.history.push({x: this.x, y: this.y});
                if (this.history.length > this.maxHistory) {
                    this.history.shift();
                }
            }
        }
        draw() {
            if (this.alpha < 0.03) return;
            for (let i = 0; i < this.history.length; i++) {
                const pos = this.history[i];
                const trailAlpha = (i + 1) / this.history.length * this.alpha * 0.6;
                ctx.globalAlpha = trailAlpha;
                ctx.fillStyle = this.color;
                const trailSize = this.baseSize * (0.3 + i / this.history.length * 0.5);
                ctx.beginPath();
                ctx.arc(pos.x, pos.y, trailSize, 0, Math.PI * 2);
                ctx.fill();
            }
            ctx.globalAlpha = this.alpha;
            ctx.fillStyle = this.color;
            ctx.strokeStyle = this.color;
            const size = this.baseSize * (0.5 + this.alpha * 0.6);
            ctx.save();
            ctx.translate(this.x, this.y);
            ctx.rotate(this.rotation);
            switch (this.shapeType) {
                case 0:
                    ctx.beginPath();
                    ctx.arc(0, 0, size, 0, Math.PI * 2);
                    ctx.fill();
                    break;
                case 1:
                    ctx.fillRect(-size, -size, size * 2, size * 2);
                    break;
                case 2:
                    ctx.lineWidth = size * 0.8;
                    ctx.beginPath();
                    ctx.moveTo(-size * 1.2, 0);
                    ctx.lineTo(size * 1.2, 0);
                    ctx.stroke();
                    break;
                case 3:
                    ctx.lineWidth = size * 0.6;
                    ctx.beginPath();
                    ctx.moveTo(-size, 0);
                    ctx.lineTo(size, 0);
                    ctx.moveTo(0, -size);
                    ctx.lineTo(0, size);
                    ctx.stroke();
                    break;
            }
            ctx.restore();
        }
    }
    class Rocket {
        constructor(x, y) {
            this.x = x;
            this.y = y;
            this.history = [];
            this.maxHistory = 18;
            const angle = (Math.random() - 0.5) * 0.52;
            this.speed = 7 + Math.random() * 10;
            this.vx = Math.sin(angle) * this.speed;
            this.vy = -Math.cos(angle) * this.speed;
            this.baseHue = Math.random() * 360;
            this.color = `hsl(${this.baseHue}, 90%, 70%)`;
            this.alive = true;
        }
        update() {
            if (!this.alive) return;
            this.x += this.vx;
            this.y += this.vy;
            this.vy += 0.14;
            this.history.push({x: this.x, y: this.y});
            if (this.history.length > this.maxHistory) {
                this.history.shift();
            }
            if ((this.vy >= 0.02) || (this.y < 120 && Math.random() * 100<=10)) {
                    this.explode();
                    this.alive = false;
            }
        }
        explode() {
            // 粒子數調到50~80
            const count = 60 + Math.floor(Math.random() * 31);
            for (let i = 0; i < count; i++) {
                const a = Math.random() * Math.PI * 2;
                const spd = 1.5 + Math.random() * 6.5; // 增加初始速度,讓粒子炸得更遠
                const vx = Math.cos(a) * spd;
                const vy = Math.sin(a) * spd - 1.8;
                particles.push(new Particle(this.x, this.y, vx, vy, null, this.baseHue));
            }
        }
        draw() {
            if (!this.alive) return;
            for (let i = 0; i < this.history.length; i++) {
                const pos = this.history[i];
                const alpha = (i + 1) / this.history.length;
                ctx.globalAlpha = 0.15 + alpha * 0.55;
                ctx.fillStyle = this.color;
                ctx.beginPath();
                ctx.arc(pos.x, pos.y, 2.5 + alpha * 2, 0, Math.PI * 2);
                ctx.fill();
            }
            ctx.globalAlpha = 1;
            ctx.fillStyle = '#ffffff';
            ctx.beginPath();
            ctx.arc(this.x, this.y, 5, 0, Math.PI * 2);
            ctx.fill();
        }
    }
    // 按住持續發射功能
    let isMouseDown = false;
    let launchInterval = null;
    let currentX = 0; // 即時滑鼠位置
    let currentY = 0;
    // 監聽滑鼠移動,即時更新位置
    document.addEventListener('mousemove', e => {
        currentX = e.clientX;
        currentY = e.clientY;
    });
    document.addEventListener('mousedown', e => {
        if (e.button === 0) { // 左鍵
            isMouseDown = true;
            // 立即發射第一個(使用即時位置)
            rockets.push(new Rocket(currentX, currentY));
            // 持續發射,每0.2秒一個
            launchInterval = setInterval(() => {
                if (isMouseDown) {
                    rockets.push(new Rocket(currentX, currentY));
                }
            }, 100); // 0.2秒 = 200ms
        }
    });
    document.addEventListener('mouseup', e => {
        if (e.button === 0) {
            isMouseDown = false;
            clearInterval(launchInterval);
        }
    });
    document.addEventListener('mouseleave', () => {
        isMouseDown = false;
        clearInterval(launchInterval);
    });
    function animate() {
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        for (let i = rockets.length - 1; i >= 0; i--) {
            const r = rockets[i];
            r.update();
            r.draw();
            if (!r.alive) rockets.splice(i, 1);
        }
        for (let i = particles.length - 1; i >= 0; i--) {
            const p = particles[i];
            p.update();
            p.draw();
            if (p.alpha <= 0.02) particles.splice(i, 1);
        }
        requestAnimationFrame(animate);
    }
    animate();
})();

https://mihoyo.wiki/Phigros/whilePlaying/index.html?play=Anomaly&l=ez&c=official

https://c.wss.ink/f/jiaa5sy41et 复制链接到浏览器打开

https://vscode.dev/tunnel/d26/d:/ZZMMXX

https://mobs.ashish.top

https://tj.imken.dev

C++
共 12 篇
  1. 题解

    题解:P17546 [JAG 2026 Summer Camp #2] Vibe Coding

    该代码解决一个涉及手动任务与AI任务调度的优化问题。核心思路是: 手动任务必须排在AI任务之后,以避免其固定成本a_i影响后续AI任务的收益计算。 按b_i降序排序所有任务,并维护一个差分数组Δ_j(表示选j个AI任务的最大收益差值),其具有严格单调递增性质。 使用FHQ-Treap数据结构高效处理动态插入和查询操作: 每次插入新任务时,通过二分查找确定其在差分序列中的插入位置,同时调整后续元素的值。 利用Treap的分裂与合并操作,保持Δ序列的单调性,从而实现O(n log n)的时间复杂度。 最终答案通过遍历Treap统计所有正贡献的Δ值,用总成本sum减去这些贡献值得到。 代码中存在潜在问题:split函数的k参数逻辑可能未正确处理边界条件,导致插入位置错误,从而引发WA。此外,差分序列的单调性假设需严格验证。

  2. 题解

    题解:P17547 [JAG 2026 Summer Camp #2] Tree + 1

    该问题要求计算树中两条不相交路径的最大长度总和,并通过公式 2n - l -1 得出最终答案。用户最初尝试使用树形DP求解,但因在DFS2中错误重复计算子树直径(如样例中节点2的子树直径被计算两次),导致结果错误。重构后的代码通过以下步骤解决: 第一次DFS:计算每个节点的子树最大深度(f1)、次大深度(f2)以及子树直径(d),用于确定子树内部的最长路径。 换根DP:在第二次DFS中,维护每个节点的子树外最长链(uph)和子树外直径(dout)。通过前后缀数组分别记录子节点的深度和直径最大值,避免重复计算。 答案更新:利用子树直径(d[v])与子树外最长链(dout[v])的和,动态更新全局最大值ans。最终答案取 max(n-1, ans),确保覆盖所有可能情况(如树本身为链时的特殊情况)。 核心改进在于通过换根DP正确处理子树外的路径信息,结合前后缀数组高效计算排除当前子节点后的最大值,从而准确求解两条不相交路径的最大总长度。

  3. 题解

    题解:P17149 [ICPC 2017 Xi'an R] Island

    该题要求计算一棵n节点树中,从节点1出发恰好能到达k个点的边摧毁方案数。每条边有50%的概率被摧毁,总共有2^{n-1}种可能情况。 TLE做法: 通过DFS遍历树,定义每个子树的生成函数F_u(x)表示包含u的连通块大小为s的方案数。合并子节点时,对每个子节点v,其贡献为(2^{siz[v]-1} + F_v(x)),其中2^{siz[v]-1}对应断开边的情况。最终答案为F_1(x)中x^k的系数。但直接多项式乘法导致O(n²)时间复杂度,无法通过大规模测试。 正解优化: 采用树链剖分与分治策略结合NTT(快速数论变换)优化。将树分解为重链和轻链,对重链进行分治处理,将生成函数的合并转化为线性变换。定义每个节点的生成函数为F_u(x) = x * (重儿子生成函数 + 常数项) * 轻儿子生成函数的乘积。通过分治合并线性变换对(A_u, B_u),其中A_u表示重儿子的贡献,B_u为常数偏置项。最终通过递归分治合并所有链段,得到包含节点1的连通块大小为k的方案数。模数为1811939329,原根为13,使用NTT加速多项式乘法,时间复杂度降至O(n log n)。

  4. 题解

    题解:AT_abc461_g [ABC461G] Graph Problem 2026

    本文是对 AtCoder ABC461G 题目的题解总结,主要内容如下: 问题转化:通过变量归一化,将最大化点权和约束问题转化为最大分数独立集问题,进一步等价于最小分数顶点覆盖问题。 算法策略:由于原图不一定是二分图,通过构建二分双倍图(每个点拆分为左右两侧),利用 König 定理将一般图的最小分数顶点覆盖转化为二分图的最大匹配。 计算公式:最终答案为 2026 × n - 1013 × maxmatching(H)。 代码实现:提供了使用 Hopcroft-Karp 算法 计算最大匹配的 C++ 代码。 附加请求:文末作者询问代码是否存在错误,并希望提供更详细的解释。

  5. 题解

    G题题解

    Solution of abc457G 题意 你要在数轴上放 n 个机器人,位置随意。 每个机器人每秒移动最多 1 个单位。机器人可以重合。如果一个机器人 T_i 秒时在坐标 X_i,那么它可以收集苹果 i。 求最少要多少个机器人才可以摘到所有苹果。 思路 观察 如果机器人想要先…

  6. 题解

    题解:CF2204G Grid Path

    本文针对 Codeforces 2204G Grid Path 问题提供了解题方案,主要内容如下: 题目分析:芯片每行移动形成连续区间 [L_i, R_i],相邻行区间必须有交集。由于起点为 (1,1),故 L_1=1。目标是计算所有可能的合法区间序列方案数。 DP 设计:定义 dp[i][L][R] 为第 i 行选择区间 [L, R] 时的合法路径数。转移方程需累加上一行与之相交的区间方案。 优化策略:直接 DP 复杂度太高。观察到转移仅依赖上一步的前缀和(sump)与后缀和(sums)。通过维护这两个数组,将状态压缩至 2m 维,结合矩阵快速幂求解,总复杂度优化至 O(m^3 log n)。 代码实现:提供了基于矩阵快速幂的 C++ 实现,包含状态构建及取模优化细节。

    1 赞
  7. 个人记录

    《和平宣言》

    《和平宣言》 钟山垂泪 大江呜咽 岁末寒岁 举国公祭 八十八载 岁月沧桑 金陵城下 血海深疆 三十万众 罹难魂殇 妇孺老幼 皆遭祸殃 尸横街巷 火焚屋梁 六朝古都 顿成坟场 人类之劫 文明之伤 民族之痛 永刻胸膛 今我中华 以国之名 降半旗志 警笛长鸣 肃立默哀 追思永续 白烛荧…

  8. 题解

    题解:CF858D Polycarp's phone book

    CF858D Solution 不是怎么时间限制这么久。 这道题是我在做某题单时刷到的。 回到正题:我们发现数据量并不大,所以会去枚举每一个字符串的子串并检查它们是否被用过。 那么检查是否被用过就立马可以想到使用 map,但是其实也能用字典树。 首先过一下流程: 1.将每一个字符…

  9. 题解

    题解:AT_joi2020ho_b JJOOII 2 (JJOOII 2)

    这道题要求通过删除字符使得字符串中保留连续的j、o、i序列,且每个字符出现次数不少于k次。题解采用贪心策略优化暴力枚举,将时间复杂度从O(n³)降至O(n log n)。核心思路是: 预处理前缀和:分别统计字符'J'、'O'、'I'的出现位置,并构建前缀和数组,便于快速计算区间内字符数量。 枚举j的区间:固定j的起始和结束位置(jl到jr),通过二分法在o和i的位置数组中找到满足条件的连续区间(ol到or,il到ir)。 计算删除次数: j区间内需删除的字符数:jr-jl+1 - (sum[0][jr] - sum[0][jl-1]) o区间内需删除的字符数:oR-oL+1 - (sum[1][oR] - sum[1][oL-1]) i区间内需删除的字符数:ir-il+1 - (sum[2][ir] - sum[2][il-1]) j与o之间、o与i之间的字符数:oL-jr-1 和 il-oR-1 取最小值:遍历所有可能的j区间,计算对应删除次数的总和,并记录最小值。若未找到有效解则输出-1。 代码关键点包括使用map存储字符位置、前缀和数组优化区间统计、二分法快速定位o和i的区间,以及通过条件判断确保各字符的连续性。需注意变量名是否正确(如sum数组的索引对应关系)及边界处理。

  10. 个人记录

    tupper s formula

    该文本包含两组数据,每组由一张图片链接和一个标记为 k 的超长整数组成。

  11. 题解

    题解:P11961 [GESP202503 五级] 原根判断

    P11961 原根判断 这道题的题意很明确,a 为质数 b 的原根有以下条件: a<b a^b-1≡1(bmod b ) 在 i=1 sim b-1 中,只有 i=b-1 时满足 a^i≡1(bmod b ) 会数学的应该都知道,如果 a 和 b 如果不互质,则第二个条件就不行。…