自定义博客皮肤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 | 熟能生巧

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

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

原创 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 888

原创 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 1127

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

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

2024-08-31 12:42:46 1521

原创 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 759

原创 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 765

原创 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 696

原创 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 1071

原创 百度之星 2024 决赛 题解

intforint1;

2024-03-18 10:00:12 2060

原创 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 1104 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 1064

原创 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 378

原创 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 569

原创 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 964

原创 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 436

原创 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 449

原创 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 1093

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

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

2023-03-25 19:25:58 283

原创 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 368

原创 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 491 2

原创 洛谷 P2371([国家集训队]墨墨的等式-背包)

墨墨突然对等式很感兴趣,他正在研究∑i1n​ai​xi​b存在非负整数解的条件,他要求你编写一个程序,给定na1n​lr,求出有多少b∈lr可以使等式存在非负整数解。

2023-03-15 08:40:41 143

原创 The 1st Universal Cup Stage 7: Zaporizhzhia, March 11-12, 2023(Determinant, or...?-子矩阵,det)

考虑这个矩阵刚好可以写成。这个性质 可以递归下去算。

2023-03-14 06:26:02 216

原创 THUPC2023 初赛(背包-同余背包)

本题中,你需要解决完全背包问题。有n种物品,第i种物品单个体积为vi​、价值为ci​。q次询问,每次给出背包的容积V,你需要选择若干个物品,每种物品可以选择任意多个(也可以不选),在选出物品的体积的和为V的前提下最大化选出物品的价值的和。你需要给出这个最大的价值和,或报告不存在体积和恰好为V的方案。为了体现你解决 NP-Hard 问题的能力,V会远大于vi​,详见数据范围部分。

2023-03-12 07:07:34 655

原创 The 1st Universal Cup Stage 5: Osijek, February 25-26, 2023 题解

Problem G. GridlandiaInput file: standard inputOutput file: standard outputTime limit: 1 secondMemory limit: 256 megabytes给一个n∗nn*nn∗n的矩阵,每个格子可以选取上下左右一条边(可以不选),所有选取的边不能共点。现在要求构造一个方案,选尽量多的边。The continent of Gridlandia is a squares of side length n, div

2023-02-28 13:44:21 579

原创 The 22nd Japanese Olympiad in Informatics (JOI 2022/2023) Final Round 题解

交题:https://cms.ioi-jp.org/documentation给一个序列 a1,⋯ ,ana_1,\cdots,a_na1​,⋯,an​。执行nnn个操作,第iii个操作为找出第iii个数前离其最近且与它相同的数的位置,把这两个数之间的数全部赋值aia_iai​。求最后的序列。考虑第iii个操作执行完后,iii之前每个数一定是连续出现正好一段或不出现。B给nnn个点对,每个点对(x,y)(x,y)(x,y)可以覆盖S=(a,b)∣b

2023-02-18 11:32:22 1143

原创 AtCoder Regular Contest 154 题解

给2个长度均为n的十进制数,你可以任意次交换2个数相同位置的数字,要求使它们乘积最小让其中一个数最小,另一个数最大。B - New Place给2个长度为n的串,每次可以把第一个串的第一个字符塞进这个字符串任意位置,问把这两个串变相同的最小次数。无解-1。有解当且仅当各个字符在2个字符串中出现次数相同贪心匹配第一个字符串中的后缀C - RollerYou are given sequences of positive integers of length A,BA,BA,BYou can rep

2023-01-23 00:30:31 1749

原创 Good Bye 2022: 2023 is NEAR 题解

Koxia and PermutationKoxia and Number TheoryKoxia and GameKoxia 和 Mahiru 正在用三个长度为 nnn的数组 a,b,ca,b,ca,b,c 玩一个游戏。其中 a,b,ca,b,ca,b,c中的每个元素都是 111到 nnn 之间的整数。游戏持续 nnn 轮。在第iii 轮中,她们进行以下操作:令 SSS是{ai,bi,ci}\{ a_i,b_i,c_i \}{ai​,bi​,ci​} 的可重集。Koxia 从可重集 SSS

2023-01-01 00:00:53 500

原创 CF 1677D(Tokitsukaze and Permutations-冒泡排序)

已知长度为n的排列,经过k次冒泡(每次把最大的数交换到最后)后,得到的新序列为aia_iai​.vi=∑j=1i−1=[ai<aj]vi=\sum_{j=1}^{i−1}=[a_i<a_j]vi=∑j=1i−1​=[ai​<aj​]现在已知viv_ivi​的某些地方的值,不知道的记vi=−1v_i=-1vi​=−1,求合法原排列数。考虑viv_ivi​和排列达成双射关系。且1次冒泡会导致viv_ivi​序列整体左移,并减1(若为0则不减)。最后添1位0也即是for(int i

2022-05-13 23:40:18 313

原创 CodeJam Qualification Round 2022

Punched Cards (11pts)Attempts1Penalties0Penalty Time25:02:57PointsdonePractice SubmissionsYou have not attempted this problem.Last updated: Apr 3 2022, 12:13PROBLEMANALYSISProblemA secret team of programmers is plotting to disrupt the progra

2022-04-03 12:21:44 629

原创 CodeTON Round 1 (Div. 1 + Div. 2, Rated, Prizes)

A Good PairsYou are given an array a1,a2,…,ana_1,a_2,…,a_na1​,a2​,…,an​ of positive integers. A good pair is a pair of indices (i,j)(i,j)(i,j) with 1≤i,j≤n1≤i,j≤n1≤i,j≤n such that, for all 1≤k≤n1≤k≤n1≤k≤n, the following equality holds:

2022-03-27 03:59:11 389

原创 AtCoder Beginner Contest 242

A#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(int i=

2022-03-08 06:32:17 621

原创 AtCoder Beginner Contest 240

A Edge Checker#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,

2022-02-23 15:41:32 505

原创 百度之星2021 决赛

A解方程得出系数#include<cstdio>#include<cstring>#include<cstdlib>#include<algorithm>#include<functional>#include<iostream>#include<cmath>#include<cctype>#include<ctime>using namespace std;#define F

2022-02-03 23:25:26 357

原创 CF 1603C(Extreme Extension-数学)

给定一个正整数序列aia_iai​。每次操作可以把一个数aaa拆成b,a−bb,a-bb,a−b两个正整数放回原位置一个序列的 extreme values 定义为将一个序列变为不降序列的最小操作步数。你希望求出所有子串的 extreme values 的和。序列长度n≤105,ai≤105n \le 10^5,a_i \le 10^5n≤105,ai​≤105只考虑一个序列的 extreme values:从末尾向前遍历,每次把数拆成尽量少的数,使最小值最大,且最大值小等于下一个数。那么对于 a

2021-11-03 19:41:03 271

原创 CF 1583F(Defender of Childhood Dreams-构造)

给一个n≤1000n\le 1000n≤1000个点有向完全图(iii向jjj连边,i<ji<ji<j)求一个合法边染色使得所有长度为kkk的路径存在至少222种颜色。把所有点分成若干大小为kkk的集合,每个集合连同一种颜色边,则其余边必须连除此以外的颜色考虑把所有点按0,⋯ ,n−10,\cdots,n-10,⋯,n−1编号,2个点之间连它们kkk进制下第一个相同的位置#include<bits/stdc++.h> using namespace std;#def

2021-10-19 20:41:38 199

原创 ICPC WF Moscow Invitational Contest(Kingdom of Islands-枚举子集)

给111个n≤1e5n\le 1e5n≤1e5个点的图,每个点有权值sis_isi​。若222个点sis_isi​不同,则连边,否则不连边。有k≤20k \le 20k≤20个特例:原来连边变成不连,或者不连变成连。求最大完全子图如果没有特例点,每个sis_isi​取一个点即可。考虑有特例的情况:两个点从连边变成不连:枚举哪个点不在子图中两个点从不连边变成连:枚举是否两个点都在子图中剩下贪心#include<bits/stdc++.h> using namespace std;

2021-10-14 19:31:33 392

原创 CF 1557D(Ezzat and Grid-线段覆盖)

一个n∗mn*mn∗m的01矩阵,初始为全0。有m个条件(i,j,k)(i,j,k)(i,j,k),表示把第iii行[j,k][j,k][j,k]列设为1。问至少删除几列,使对任意相邻行,至少存在一列,其值均为111

2021-08-19 18:09:41 137

原创 HDU 6982(Road Discount-wqs二分)

给你一个无向图nnn个点mmm条边,每个边有一个代价cic_ici​以及折扣价did_idi​,现在要求对每个k(0≤k≤n−1)k(0\le k \le n-1)k(0≤k≤n−1),求恰取kkk条折扣价的最小生成树的代价是多少。n≤1e3,m≤2e5,ci,di≤1e3n\le 1e3,m\le2e5,c_i,d_i\le 1e3n≤1e3,m≤2e5,ci​,di​≤1e3#include<bits/stdc++.h> using namespace std;#define For

2021-08-03 11:22:13 256

原创 Codeforces LATOKEN Round 1 (Div. 1 + Div. 2)

A Colour the Flag#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

2021-06-22 07:30:52 201

原创 Tokio Marine & Nichido Fire Insurance Programming Contest 2021(AtCoder Regular Contest 122) 题解

A Many Formulae#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

2021-06-12 23:14:57 334

原创 Yandex Cup 2020(Catherine the developer works from home-给n个整点问能构成几个至少有一对平行边的四边形)

给n个整点问能构成几个至少有一对平行边的四边形n≤1000n\le 1000n≤1000通过枚举2个平行的边来数至少有一对平行边的四边形,由于平行四边形会被计算2遍需要去重#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

2020-11-15 10:51:33 320

空空如也

空空如也

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

TA关注的人

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