自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

nike0good |Oier&ACMer | 熟能生巧

有所作为是生活中的最高境界。

  • 博客(1123)
  • 收藏
  • 关注

原创 ABC 378G(Everlasting LIDS-Robinson–Schensted correspondence)

一个非负整数 n(总方格数)的 整数分拆(integer partition)λ\lambdaλ有PnP_nPn​(划分数)个。可以用一个整数分拆表示一个杨表λλ1λ2λλ1λ2给定一个共有 n 个方格的杨表πλπλ​,把 1 到 n 的 n 个数字填入杨表中,使得每行从左到右,每列从下到上都是递增的。用dimπλdimπλ​​表示可以这样填的方法个数。勾长hookvhookv。

2025-11-15 05:26:03 857

原创 AtCoder Beginner Contest 430 题解

题目要求计算满足特定条件的排列数。给定长度为N的整数序列A和正整数D,要求通过重新排列A得到序列B,使得对于所有1≤i≤N-1,满足B_{i+1}≥B_i-D。采用插入法解题思路,每次按升序插入元素,确保新插入的数与后一个数满足差值条件。最终结果需对998244353取模。实现时通过预处理阶乘和逆元来优化组合数计算。

2025-11-11 15:53:02 941

原创 Meta Hacker Cup 2025 Round 1 题解

Problem A2: Snake Scales (Chapter 2)Problem B1: Final Product (Chapter 1)Problem B2: Final Product (Chapter 2)Problem C: Narrowing DownProblem D: Crash Course一个括号序列,A每次拿走一个(括号结尾的前缀,B每次拿走1个)为首的后缀,轮流操作,无法操作者输,A先手。问谁赢。如果一个序列是括号序列,且‘(’数量大于等于’)’,那么要么它是

2025-10-25 02:55:27 774

原创 AtCoder Beginner Contest 421 题解

本文包含两个编程题目解答:1) A Misdelivery 判断指定位置的字符串是否匹配;2) B Fibonacci Reversed 计算斐波那契数列并反转输出。两个程序都使用了标准的C++输入输出和数据结构处理,其中第二题还涉及字符串反转操作。

2025-09-04 02:31:02 970

原创 Leetcode concurrency List

本文展示了四个多线程同步问题的解决方案:1) Foo类确保first、second、third方法按序执行;2) FooBar类交替打印"foo"和"bar";3) ZeroEvenOdd类交替打印0与奇偶数;4) H2O类协调氢氧线程生成水分子。所有方案均使用互斥锁和条件变量实现线程同步,其中H2O问题还引入了原子计数器来精确控制氢氧原子比例。这些代码示例展示了如何在多线程环境下实现精确的执行顺序控制和资源协调。

2025-07-16 12:59:40 745

原创 Educational Codeforces Round 180 (Rated for Div. 2) 题解

2025-06-25 12:44:00 1085

原创 Codeforces Round 1031 (Div. 2) 题解

题目A是关于烤肉店烤架温度管理的问题,需要计算在初始温度k下最多能烤制多少份两种不同类型的烤肉(类型1要求温度≥a,烤后温度降x;类型2要求≥b,降y)。解题思路是优先处理降温幅度较小的类型,并考虑剩余温度能否继续烤制另一种类型。 题目B是屋顶覆盖问题,要求在给定的w×h矩形屋顶上,用a×b大小的板子完全覆盖,需要考虑两块已放置的不重叠板子的限制条件,判断是否还能完成覆盖。代码框架显示需要处理多种可能的放置方案。 两个问题都涉及资源分配的优化计算,前者关注温度限制下的最优解,后者则考察几何空

2025-06-19 19:22:49 911

原创 AtCoder Regular Contest 197 (Div. 2) 题解

2025-05-05 19:05:29 1164

原创 Codeforces Round 1022 (Div. 2) 题解

B SUMdamental DecompositionC Neo’s EscapeD Needle in a NumstackE Spruce DisputeF Fallen Towers皮萨诺建造了由 nnn 座塔楼组成的 aaa 阵列,每座塔楼由 ai≥0a_i \ge 0ai​≥0 块砖块组成。皮扎诺可以推倒一座塔,使接下来的 aia_iai​ 座塔增加 111 个。换句话说,他可以利用 aia_iai​ 元素,将接下来的 aia_iai​ 元素增加一个,然后将 aia_iai​ 设

2025-05-04 15:11:17 1312

原创 Codeforces Round 1019 (Div. 2) 题解

You are given an array of integers a1,a2,…,ana_1, a_2, \ldots, a_na1​,a2​,…,an​. An array x1,x2,…,xmx_1, x_2, \ldots, x_mx1​,x2​,…,xm​ is beautiful if there exists an array y1,y2,…,ymy_1, y_2, \ldots, y_my1​,y2​,…,ym​ such that the elements of yyy are dist

2025-04-23 12:29:08 847

原创 Neowise Labs Contest 1 (Codeforces Round 1018, Div. 1 + Div. 2) 题解

BC Wonderful City给1个矩阵,第i行加1需要ci代价,第i列需要di代价,每行,每列只能加1次。问最小代价使矩阵不存在相邻元素相同。每行每列取不取只被上行影响。行列可分离考虑。D Wonderful LightbulbsYou are the proud owner of an infinitely large grid of lightbulbs, represented by a Cartesian coordinate system. Initially, all of th

2025-04-23 11:15:27 1127

原创 AtCoder Beginner Contest 401 题解

B UnauthorizedC K-bonacciD Logical FillingE Reachable SetF Add One Edge 3一个树上点的最远点是直径的两个点之一G Push Simultaneously二分,二分图匹配

2025-04-22 07:07:38 654 2

原创 April Fools Day Contest 2025

直接输出一行B Plinko给一个弹珠游戏找起始点,要求掉到底。输出-1,直接从场外掉C Would It Be Unrated?猜有多少testcase,只能靠穷举,但是只要有人过了。提交页面可以查看过了至少k的点的提交。D Where Am I?给一个位置求坐标需要使用google街景定位,右键可以确定坐标。虽然图片看起来在纽约,但实际是在拉斯维加斯E Pair Count给你一个质数 ppp , nnn 个整数 a1,a2,…,ana_1, a_2, \ldots, a_na1

2025-04-02 11:58:03 989

原创 Japan Registry Services (JPRS) Programming Contest 2025#1 (AtCoder Beginner Contest 392) 题解

B - Who is Missing?C - BibD - DoublesE - Cables and ServersF - InsertG - Fine Triplets给NNN个两两不同的数SiS_iSi​,问能凑出多少三元组,正好可以组成等差序列。1≤N,Si≤1061\le N,S_i \le 10^61≤N,Si​≤106枚举中间那个数,另外两个数的和是确定的,上FFT。

2025-02-09 07:45:30 917

原创 Good Bye 2024: 2025 is NEAR 题解

A Tender Carpenter给一个数列分是否存在至少2种划分方式使得划分后每个子段中的数任取(可重复取)3个都能作为三角形的3条边长。#include<bits/stdc++.h> using namespace std;#define For(i,n) for(int i=1;i<=n;i++)#define Fork(i,k,n) for(int i=k;i<=n;i++)#define ForkD(i,k,n) for(int i=n;i>=k;i-

2024-12-30 05:06:11 996

原创 ABC 385G(Counting Buildings-多项式)

求有多少个长度为 n 的排列 P,其从左往右的单调栈长度L§ 和从右往左的单调栈长度R§之差为 k。表示长度为i且差值为j的答案。

2024-12-27 05:48:02 1075 2

原创 AtCoder Beginner Contest 382 题解

A - Daily Cookie int n,k; cin>>n>>k; string p; cin>>p; int c=0; Rep(i,p.length()) c+=p[i]=='@'; cout<<n-c+min(k,c);B - Daily Cookie 2 int n,k; cin>>n>>k; string p; cin>>p; RepD(i,n-1) { if(p[i]=='@

2024-12-03 23:38:29 1116

原创 AtCoder Beginner Contest 380 题解

A - 123233#include<bits/stdc++.h> using namespace std;#define For(i,n) for(int i=1;i<=n;i++)#define Fork(i,k,n) for(int i=k;i<=n;i++)#define ForkD(i,k,n) for(int i=n;i>=k;i--)#define Rep(i,n) for(int i=0;i<n;i++)#define ForD(i,n) f

2024-11-17 00:51:30 807

原创 Meta Hacker Cup 2024 Round 2 题解

Cottontail Climb (Part 1)暴力枚举Cottontail Climb (Part 2)暴力枚举Problem B: Four in a Burrow记忆化搜索Problem C: Bunny Hopscotch统计todo

2024-10-22 08:57:19 1223

原创 Meta Hacker Cup 2024 Round 1 题解

Meta Hacker Cup 2024 题解

2024-10-07 17:03:01 1174

原创 KEYENCE Programming Contest 2024(AtCoder Beginner Contest 374) 题解

Problem StatementKEYENCE has a culture of addressing everyone with the suffix “-san,” regardless of roles, age, or positions.You are given a string S consisting of lowercase English letters.If S ends with san, print Yes; otherwise, print No.B - Unvarnish

2024-10-06 10:02:51 1096 2

原创 AtCoder Beginner Contest 366 题解

B -B - Vertical WritingC - Balls and Bag QueryD - Cuboid Sum QueryE - Manhattan Multifocal EllipseF - Maximum CompositionG - XOR Neighbors给一个n个点m条边的无向连通图,给每个点分配点权([1,260][1,2^{60}][1,260]中的整数),要求对于所有度数非0的点,所有和它相邻的点(不包括自己)的点权xor和为0.高斯xor消元。每个点要么是

2024-09-14 12:43:52 1110

原创 AtCoder Beginner Contest 369 题解

A - 369#include<bits/stdc++.h> using namespace std;#define For(i,n) for(int i=1;i<=n;i++)#define Fork(i,k,n) for(int i=k;i<=n;i++)#define ForkD(i,k,n) for(int i=n;i>=k;i--)#define Rep(i,n) for(int i=0;i<n;i++)#define ForD(i,n) for(

2024-09-01 21:53:26 1343

原创 Codeforces Round 969 (Div. 1) 题解

题意:给定一棵树,点权为0或1。定义一个叶子的权值为:考虑从根到叶子的这条路径的点权组成的字符串,权值为其中01作为连续子串出现次数减去10作为连续子串出现次数。定义树的价值为:权值非零的叶子个数(不包括root节点1)。现在一些点权变成 ?,博弈的两人分别填充,先手最大化,后手最小化树的价值。求最终树的价值。解法:一条路径计入答案当且仅当叶子和根权值不同。所以只和根和叶子的权值有关。若根的权值确定,则策略显然;若根的权值不确定,一个思路是看叶子节点填过的0和1哪个多,按自己的目标填;实际上当叶子

2024-08-31 12:42:46 1910

原创 BZOJ 五月胡乱补题

【BZOJ 3242: [Noi2013]快餐店】树形dp,要么最远点在同一颗树上(dp),要么在不同树上,此时答案=去掉任何一条边后形成的树的答案的最小值,我们枚举去掉的那条边。【BZOJ 4878: [Lydsy2017年5月月赛]挑战NP-Hard】染色问题,每次沿边染max,注意最后如果颜色数超过k,则可以按(k+1)-k-…由于答案=s[i]-s[j]+dis[i]+dis[j],i,j可以分开考虑,也可以用线段树解决。【BZOJ 4972: [Lydsy八月月赛]小Q的方格纸】前缀和。

2024-08-25 18:08:53 873

原创 AtCoder Beginner Contest 367 题解

B - Cut .0C - Enumerate SequencesD - PedometerE - Permute K timesF - Rearrange QueryYou are given sequences of positive integers of length NNN: A=(A1,A2,…,AN)A=(A_1,A_2,\ldots,A_N)A=(A1​,A2​,…,AN​) and B=(B1,B2,…,BN)B=(B_1,B_2,\ldots,B_N)B=(B1​,B2

2024-08-25 11:31:44 877

原创 UNIQUE VISION Programming Contest 2024 Spring(AtCoder Beginner Contest 346)

文章目录A - Adjacent ProductB - PianoC - ΣD - Gomamayo SequenceE PaintF SSttrriinngg in StringStringA - Adjacent Product#include<bits/stdc++.h> using namespace std;#define For(i,n) for(int i=1;i<=n;i++)#define Fork(i,k,n) for(int i=k;i<=n;i++

2024-04-16 22:28:54 806

原创 The 2nd Universal Cup. Stage 25: Shenzhen 题解

A good problem should have a concise statement.You are given an array a of length n, initially filled with zeros, and another array b of length n. Your goalis to transform array a into array b. You can perform the following two types of operations:• 1 x

2024-03-18 10:25:00 1401

原创 百度之星 2024 决赛 题解

intforint1;

2024-03-18 10:00:12 2688

原创 Hello 2024 题解

B. Plus-Minus SplitC. Grouping Increases给一个数列,不改变相对顺序前提拆成2个数列。问这2个数列中,相邻且前一个数小于后一个数的数对的最小值贪心,维护2个数列队尾的值,如果都会增加数对或都不会,则放到队尾数小的那个。不然放不会增加数对的那个。D. 01 Tree给一个树,所有非叶子节点均有左右2个子节点,边权分别0和1(可以对调)。已知所有叶子节点的按dfs序排列后的到根的最短路径长。问是否合法?dfs_order = []function dfs(

2024-01-13 19:32:58 1196 1

原创 Good Bye 2023 题解

sequence a, whose product was equal to 2023, k numbers were removed, leaving a sequence b of length n. Given the resulting sequence b, find any suitable sequence a and output which k elements were removed from it, or state that such a sequence could not ha

2024-01-11 10:41:14 1167

原创 Meta Hacker Cup 2023 Round 1 题解

给一个数列,要求分成若干组,要求每组至少2个数,使得所有组中位数的最大值与最小值之差尽量大,求这个值。Problem B1: Sum 41 (Chapter 1)Given a positive integer P, please find an array of at most 100 positive integers which have a sum of 41 and a product of P, or output −1 if no such array exists.If multipl

2023-10-19 22:33:25 460

原创 Codeforces Round 875 (Div. 1) 题解

A Copil Copac Draws Trees#include<bits/stdc++.h> using namespace std;#define For(i,n) for(int i=1;i<=n;i++)#define Fork(i,k,n) for(int i=k;i<=n;i++)#define ForkD(i,k,n) for(int i=n;i>=k;i--)#define Rep(i,n) for(int i=0;i<n;i++)#def

2023-06-06 04:43:14 632

原创 The 1st Universal Cup Stage 13: Iberia, Apr 22-23, 2023 题解

D. XOR DeterminantYou are given two arrays b and c of length n, consisting of non-negative integers. Construct n × n matrixA as Aij = bi ⊕ cj . Find the determinant of A modulo 998 244 353考虑Aij=∑kbi,kcj,k+pA_{ij}=\sum_k b_{i,k}{c_{j,k}}+pAij​=∑k​bi,k​cj

2023-05-03 14:42:04 1075

原创 The 1st Universal Cup Stage 12: ̄Ookayama, April 15-16, 2023 题解

A XOR Tree Path给一颗树,树上点有黑白两色,每次可以选一个叶子节点,翻转其到根路径上所有点的颜色,问最大黑色点数。树dp#include<bits/stdc++.h> using namespace std;#define MAXN (100000+10)#define ll long long#define F (100000000)#define Rep(i,n) for(int i=0;i<n;i++)#define next Nextint n,e

2023-04-17 22:12:17 502

原创 April Fools Day Contest 2023 题解

A Are You a Robot?print("security")B Was it Rated?#include<bits/stdc++.h> using namespace std;#define For(i,n) for(int i=1;i<=n;i++)#define Fork(i,k,n) for(int i=k;i<=n;i++)#define ForkD(i,k,n) for(int i=n;i>=k;i--)#define Rep(i,n)

2023-04-12 20:41:31 530

原创 Codeforces Round 860 (Div. 2) 题解

A Showstopper#include<bits/stdc++.h> using namespace std;#define For(i,n) for(int i=1;i<=n;i++)#define Fork(i,k,n) for(int i=k;i<=n;i++)#define ForkD(i,k,n) for(int i=n;i>=k;i--)#define Rep(i,n) for(int i=0;i<n;i++)#define ForD(i,n

2023-03-29 16:39:07 1185

原创 The 1st Universal Cup Stage 8: Slovenia, March 18-19, 2023(Differences-字符串hash)

找出一个串,和任何一个串Hamming距离均为为。考虑hash,给每个串随机分配一个随机数。为了保障成立可以多随机几次。表示第i个位置为字母。

2023-03-25 19:25:58 356

原创 THUPC2023 初赛(最后的活动-dp概率二分)

各位亲爱的《La Lumière: Scarlet Intense Flame》玩家:我们非常遗憾地宣布,《La Lumière: Scarlet Intense Flame》将于 2023 年 3 月 5 日 16:00 停止运营服务。停止运营相关时间表如下:……

2023-03-24 13:03:51 484

原创 The 1st Universal Cup. Stage 8: Slovenia.(Skills in Pills-dp)

Problem K. Skills in PillsInput file: standard inputOutput file: standard outputTime limit: 1 secondMemory limit: 256 megabytesAn unnamed protagonist of this task received amazing e-mail offers for wondrous pills that will enhancetheir cognitive and

2023-03-21 11:39:09 606 2

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除