Silver: Subsequences Summing to Sevens

Silver: Subsequences Summing to Sevens

Silver: Subsequences Summing to Sevens P3131 USACO16JAN] Subsequences Summing to Sevens S 其实也是简单题,只需要发现一个规律:取模7之后再存psum里面的话,当psum[i]=psum[j],psum[j]-p

Silver: Breed Counting

Silver: Breed Counting

Silver: Breed Counting [P6180 USACO15DEC] Breed Counting S - 洛谷 | 计算机科学教育新生态 简单题,康复训练了。只要开 3 个数组分别记前缀和就好。顺便一提这个 competitest.nvim 真好用xeluxee/competites

Silver: Range Reconstruction

Silver: Range Reconstruction

Silver: Range Reconstruction [P8902 USACO22DEC] Range Reconstruction S - 洛谷 这道构造题只要想清楚其实还是比较好做的。(但是如果没想出来就容易绷不住).对于任何的一个a[i],它都可以是: diff[i-1][1]\pm a[

Gold: Lasers and Mirrors

Gold: Lasers and Mirrors

Gold: Lasers and Mirrors USACO.guide上的 normal星标:P3036 USACO16DEC] Lasers and Mirrors G 当时做的时候忘记blog了,这里放个代码 // // Created by Chixiyu on 1/1/2024. // #

CSES: Labyrinth

CSES: Labyrinth

CSES: Labyrinth USACO.guide上的 easy: CSES - Labyrinth 这道确实简单,但是好久没写图论了生疏了还搞了一整子的😓. 思路 思路就是从A跑BFS到B,非常简单。所以现在就可以开始写了: 代码1 // // Created by Chixiyu on 1

Graph Templates

Graph Templates

Dijkstra Dijkstra 算法是(在数据结构优化情况下)在O(mlog_2n)时间复杂度下的单源最短路径算法。 P4779 【模板】单源最短路径(标准版)模板代码: // // Created by asdf on 1/29/2024. // #include <bits/stdc++.h

CF: Remove the Ends

CF: Remove the Ends

CF: Remove the Ends Problem - C - Codeforces 这题绝对不止1281分,估计1600+,但是疑似是赛时太多人开挂了导致评分过低。 思路1(TLE):记忆化硬搜 直接记忆化硬搜,开个 unordered_map,注意要把 l 和 r 的状态通过编码来结合成一个

CF: Increasing Frequency

CF: Increasing Frequency

CF: Increasing Frequency Problem - 1082E - Codeforces 怎么说呢,DP的灵活度确实是比较高。当我看到 dp的tag时我已经在想怎么定状态想怎么转移什么的了。但是呢,其实这道题不用那个角度思考也可以,而且做题最重要的是找到数据的规律再总结出解决方案。

CF: Mortal Combat Tower

CF: Mortal Combat Tower

CF: Mortal Combat Tower Problem - 1418C - Codeforces 简单题。。。。。但是题解1调试了我好久,主要是有老6影藏bug 题解1:DP 简单粗暴记忆化搜索所有情况: 状态:dp[i][j]意思是在走到位置j上切到了玩家i\in[0,1]。0=我队友,1

CSES: Coin Combinations I

CSES: Coin Combinations I

CSES: Coin Combinations I CSES - Coin Combinations I 和Dice combination很像,dp[i]的定义还是一样,只需要微调一下,见代码: /* * Created by: Chixiyu * Date: 2025-02-12 */ #