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

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

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

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

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

原创 百度之星 2024 决赛 题解

intforint1;

2024-03-18 10:00:12 467

原创 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 994 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 940

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

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

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

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

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

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

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

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

2023-03-25 19:25:58 252

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

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

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

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

2023-03-15 08:40:41 123

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

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

2023-03-14 06:26:02 170

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

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

2023-03-12 07:07:34 612

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

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

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

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

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

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

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

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

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

原创 百度之星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 286

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

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

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

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

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

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

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

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

原创 Kick Start Round F 2020(Yeetzhee-划分数)

ProblemPommel is very bored at home so she has invented a new game involving N dice. Each die has the numbers from 1 to M written on it. Whenever she throws a die, it has an equal probability of landing on each of the M possible values.Pommel places all

2020-09-30 12:32:10 251

原创 2020 年百度之星·程序设计大赛 - 复赛(Battle for Wosneth2-概率)

Problem Description你在打游戏的时候碰到了如下问题:​ 有两个人记作Alice和Bob,生命值分别是n,m,命中率分别为p%,q%。两个人轮流攻击对方,从Alice开始攻击,每次攻击的时候,如果命中,那么能让对方的生命值减低1,直到一方的生命值不超过0为止。求到最后Alice的生命值大于0的概率,对998244353取模。对于一个分数a/b,其中gcd(a,b)=1,那么我们认为这个分数对998244353取模的值为一个数c(0≤c<998244353)满足bc≡a(mod

2020-08-11 07:24:17 663 3

原创 Codejam Round 3 2020(Naming Compromise-DP)

ProblemCameron and Jamie are about to welcome a second baby into their lives. They are already good at working together as parents, but right now they are disagreeing about one crucial thing! Cameron wants to name the baby one name (the string C), whereas

2020-06-07 17:17:10 309

原创 2050 Programming Competition 题解

1001 开场白来自世界各地的年青人在 https://2050.org.cn 握手团聚, 他们是航空航天的新生代,编程大赛的优胜者,35岁以下的创新者,科技公司的创始人,展望未来的科学家,天马行空的艺术家… TA们期待在这里与所有人分享交流,给彼此灵感,给未来答案。我们想要用10个题目,大声喊出年青人的声音。我们希望和大家一起用技术创造一个更好的2050。第一道题目,我们来玩一个数字游戏。...

2019-04-18 11:53:38 622

原创 CCPC-Wannafly Winter Camp Day7

A.迷宫有一个 nnn 个点 n−1n-1n−1 条边的无向连通图迷宫,其中有些点上面有人.现在所有人的目标都是逃离这个迷宫,而迷宫的出口是 1 号点,每一时刻,会依次发生以下的事情:1.在点 x 上的人选择一个点 f(x)f(x)f(x) 作为目标,要求 f(x)f(x)f(x) 必须是 xxx,或者与 xxx 有边相连的点,且对于 x≠yx\neq yx̸​=y,有 f(x)≠f(y)f...

2019-01-27 13:24:29 654 1

空空如也

空空如也

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

TA关注的人

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