• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

RomanLin

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

2026年5月22日

【随机双模数哈希】LeetCode 3934. 最短唯一子数组

摘要: 题目 https://leetcode.cn/problems/smallest-unique-subarray/description/ 参考代码 struct Hash { static constexpr long long MOD1 = 1e9 + 7, MOD2 = 1e9 + 9; lo 阅读全文

posted @ 2026-05-22 00:48 RomanLin 阅读(2) 评论(0) 推荐(0)

2026年5月17日

【迪杰斯特拉】LeetCode 743. 网络延迟时间

摘要: 题目 https://leetcode.cn/problems/network-delay-time/description/ 题解 这是典型的单源最短路径模板题,思路是使用迪杰斯特拉算法算出从源点到所有点的最短路径的最大值,若存在无法抵达的目标点,则答案输出 \(-1\)。 参考代码 // 最短路 阅读全文

posted @ 2026-05-17 16:21 RomanLin 阅读(2) 评论(0) 推荐(0)

2026年4月28日

【单点修改,区间查询】洛谷 P3374 【模板】树状数组 1

摘要: 题目 https://www.luogu.com.cn/problem/P3374 参考代码 #include<bits/stdc++.h> typedef long long ll; template<typename E, typename F, typename F_INVERSE> clas 阅读全文

posted @ 2026-04-28 23:55 RomanLin 阅读(6) 评论(0) 推荐(0)

2026年4月20日

【种类并查集】洛谷 P2024 [NOI2001] 食物链

摘要: 题目 https://www.luogu.com.cn/problem/P2024 题解 种类并查集又称为扩展域并查集,是并查集的一种扩展形式,主要用于处理多组对立关系或多种状态划分的问题。在处理种类并查集问题时,有多少种类,就得开几倍的空间,用于表示所有的种类。 由题意,不妨假设现在有 \(n\) 阅读全文

posted @ 2026-04-20 00:43 RomanLin 阅读(8) 评论(0) 推荐(0)

2026年4月19日

【勾股定理】牛客周赛 Round 140 F. 小红的三角形构造

摘要: 题目 https://ac.nowcoder.com/acm/contest/132940/F 题解 构造勾股数的结论:奇数平方取一半,偶数半方加减一。 参考代码 #include<bits/stdc++.h> using namespace std; int main() { int T; cin 阅读全文

posted @ 2026-04-19 21:42 RomanLin 阅读(17) 评论(0) 推荐(0)

2026年4月14日

【第十七届蓝桥杯大赛】省赛 C/C++ B组 题解

摘要: A题 青春常数 #include<bits/stdc++.h> using namespace std; int main() { cout << 2026202520242023LL / 2LL + 1LL; return 0; } B题 双碳战略 #include<bits/stdc++.h> 阅读全文

posted @ 2026-04-14 23:15 RomanLin 阅读(108) 评论(0) 推荐(0)

2026年4月12日

【种类并查集】洛谷 P1892 [BalticOI 2003] 团伙 (Day 2)

摘要: 题目 https://www.luogu.com.cn/problem/P1892 题解 种类并查集又称为扩展域并查集,是并查集的一种扩展形式,主要用于处理多组对立关系或多种状态划分的问题。在处理种类并查集问题时,有多少种类,就得开几倍的空间,用于表示所有的种类。 由题目已知 \(n\) 个人,他们 阅读全文

posted @ 2026-04-12 23:03 RomanLin 阅读(16) 评论(0) 推荐(0)

2026年4月11日

【 整数奇偶性运算法则】洛谷 P9231 [蓝桥杯 2023 省 A] 平方差

摘要: 前言 整数奇偶性运算法则也称为奇偶律,主要包含以下运算规则: 奇数 × 奇数 = 奇数 偶数 × 任何数 = 偶数 奇数 + 奇数 = 偶数 奇数 + 偶数 = 奇数 偶数 + 偶数 = 偶数 题目 https://www.luogu.com.cn/problem/P9231 题解 首先列出所有完全 阅读全文

posted @ 2026-04-11 16:09 RomanLin 阅读(12) 评论(0) 推荐(0)

2026年4月5日

【划分型贪心+因式分解】codeforces 1992 F. Valuable Cards

摘要: 题目 https://codeforces.com/contest/1992/problem/F 题意 输入一个正整数 \(T(1 \leq T \leq 10^3)\),表示一共 \(T\) 组测试用例,保证所有测试用例的 \(n\) 之和不超过 \(10^5\)。对于每个测试用例: 第一行输入两 阅读全文

posted @ 2026-04-05 22:44 RomanLin 阅读(12) 评论(0) 推荐(0)

2026年3月29日

【贪心+构造】codeforces 2209 D. Ghostfires

摘要: 题目 https://codeforces.com/contest/2209/problem/D 题意 第一行输入一个正整数 \(T(1 \leq T \leq 10^4)\),每个测试用例给定三个整数 \(r,g,b(0 \leq r,g,b \leq 10^6,r+g+b > 0)\),代表有 阅读全文

posted @ 2026-03-29 15:34 RomanLin 阅读(9) 评论(0) 推荐(0)

下一页
 
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3