首页 > TAG信息列表 > Petya
题解【CF1082G Petya and Graph】
传送门。 $\texttt{Description}$ 定义图权 $=$ 图中边权总和 $-$ 图中点权总和。求无向图最大权子图。 $1\le n,m\le 10^3$. $\texttt{Solution}$ 最大权子图模型,考虑用最小割来解决。 所以说一个初步思路是选择所有边,然后 扣去一些边权(不选这个边) 扣去一些点权(选择了相应的边,但BZOJ3764 Petya 的序列
由于某种莫名其妙的原因一定要把这道题调完。。。 设幸运数字的个数为 \(s\) 。 这个题目一共就没几个切入点,所以要么在每个幸运数字上做手脚,要么就枚举端点然后优化。 然后你套路地枚举最左边的端点,记为 \(l\) ,算出这样每个合法的区间总数是多少。 然后不知道怎么做,枚举左边区间【环形线性区间dp】[CF]E. Petya and Post
【环形线性区间dp】[CF]E. Petya and Post 题意(稍微变型):有n个加油站,编号为1到n,且每个加油站都能提供\(a_i\)的油量(只能提供一次),并且从一个加油站到相邻的加油站会消耗一定量的油量。求在这n个加油站中有几个加油站可以满足顺时针或者逆时针地整整跑完一圈? 思路:如果中途一旦出现油CF w4d1 A. Two Semiknights Meet
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares b什么是Living off the Land?
在过去的几年中,Living off the Land一直是网络安全的流行语,但这意味着什么呢? 在陆地上生活与耕种无关 近年来,网络犯罪分子使用“Living off the Land”(LotL)策略和工具已成为网络安全领域CF1042D Petya and Array
\(\Large\textbf{Solution: } \large{感觉是特别经典的一类题目啊,有多种方法,先介绍一种以后再写。\\题目的要求其实就是求sum[i] - sum[j] < t的区间个数,其中sum[i]表示到i的前缀和。\\移项式子为sum[j] > sum[i] + t,发现和逆序对很像,所以考虑归并排序统计答案。}\) \(\Large\textCF思维联系– CodeForces - 991C Candies(二分)
ACM思维题训练集合 After passing a test, Vasya got himself a box of n candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies for himself. ThiPetya and Array(权值线段树)
Petya and Array(luogu) Description 求有多少个区间[l,r][l,r][l,r满足sum[l,r]<t n<200000,|di|<1e9,t<2e14 Solution 权值线段树为l,r表示权值的线段树,相当于对桶进行线段树操作, 更形象一点,可称为值域线段树 设a数组为前缀和 则满足条件的[l,r]符合a[r]-a[l-1]<t, 即a[r]<t+a[l-1]Codeforces Round #610 (Div. 2) C. Petya and Exam
链接: https://codeforces.com/contest/1282/problem/C 题意: Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes. The exam consists of n problems that can be solvedG. Petya and Graph(经典项目与项目消耗问题)(网络流)
题:https://codeforces.com/contest/1082/problem/G 题意:给定有边权和点权的图,问你选一些边,然sum边-sum点最大(点权被多次用为公共点只会减一次) 分析:求最大闭合子图 选了点就要减去该点点权,选了边就加边权,然而俩点确定一边,我们可以理解为要做成一件事需要消耗(点权),事成后会有一CF1214E-Petya and Construction Set(树上构造)
CF1214E-Petya and Construction Set(树上构造) 题目传送门 题意:首先给你一个n(1<=n<=1e5),接着输入n个数,第 i 个数 di(1<=di<=n)d_i(1<=d_i<=n)di(1<=di<=n) 表示点 i∗2i*2i∗2 和点 i∗2−1i*2-1i∗2−1 之间的距离为 did_idi ,最后,请你构造出这棵树并输出。 思路:首【Codeforces 1042D】Petya and Array
【链接】 我是链接,点我呀:) 【题意】 题意 【题解】 把a[i]处理成前缀和 离散化. 枚举i从1..n假设a[i]是区间和的a[r] 显然我们需要找到a[r]-a[l]<t的l的个数 即a[r]<t+a[l] 那么我们处理完每个i之后,每次把a[i]+t加入到树状数组中去。 每次以进入i的时候,找到比a[r]大的aCodeforces Round #481 (Div. 3)Petya's Exams CodeForces - 978G
Petya studies at university. The current academic year finishes with nn special days. Petya needs to pass mm exams in those special days. The special days in this problem are numbered from 11 to nn. There are three values about each exam: sisi — theD. Petya and Array 树状数组
题意: 给出一个数组,元素有正有负有0,问其区间和小于 t 的子区间的个数。 sum[ r ]-sum[ l-1 ]<t,其中sum是a的前缀和。 实现的方法就是从前往后对于每一个sum[ i ],看在它前面有多少个大于等于sum[ i ] - t 的前缀和。 树状数组维护的是 i 前面有几个数小于等于它 1 #includeCF886C Petya and Catacombs
题目描述 A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs. Catacombs consist of several rooms and bidirectional passages between some pairs of the