08 2020 档案

摘要:##题目 Dearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) whi 阅读全文
posted @ 2020-08-31 20:56 Luglucky 阅读(175) 评论(0) 推荐(0)
摘要:##题目 As you know, all the computers used for ACM contests must be identical, so the participants compete on equal terms. That is why all these compute 阅读全文
posted @ 2020-08-28 23:43 Luglucky 阅读(206) 评论(0) 推荐(0)
摘要:##题目 (left->)[https://www.luogu.com.cn/problem/solution/P4012] ##思路 首先考虑费用和流量分别是什么,那么很显然,费用是步数,流量是价值。那么接下来考虑建图,首先源点连机器人,汇点连目的地,这都没问题。然后考虑相邻的点并且可以行走的话就 阅读全文
posted @ 2020-08-27 23:21 Luglucky 阅读(159) 评论(0) 推荐(0)
摘要:##Problem B ###题目 You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So 阅读全文
posted @ 2020-08-26 23:50 Luglucky 阅读(223) 评论(0) 推荐(0)
摘要:##题目 (戳我)[https://www.luogu.com.cn/problem/solution/P4016] ##思路 讲一下费用流的建图,首先我们需要做的肯定是做到数量平均,所以我们考虑大于平均值的边应该是要出流的,小于的应该是要流入的,题目要求的是搬运量,自然而然它就是费用,我们在相邻的 阅读全文
posted @ 2020-08-26 23:21 Luglucky 阅读(157) 评论(0) 推荐(0)
摘要:##Problem B ###题目 A competitive eater, Alice is scheduling some practices for an eating contest on a magical calendar. The calendar is unusual because 阅读全文
posted @ 2020-08-25 17:56 Luglucky 阅读(159) 评论(0) 推荐(0)
摘要:##题目 roblem Description Little Q's factory recently purchased m pieces of new equipment, labeled by 1,2,…,m. There are n workers in the factory, label 阅读全文
posted @ 2020-08-25 13:33 Luglucky 阅读(175) 评论(0) 推荐(0)
摘要:##求最小值 while (l<r) { int mid= (l+r)>>1; if (check (mid)) r=mid; else l=mid+1; } ##求最大值 while (l<r) { int mid= (l+r+1)>>1; if (check (mid)) l=mid; else 阅读全文
posted @ 2020-08-24 19:11 Luglucky 阅读(195) 评论(0) 推荐(0)
摘要:##Problem B ###题面 In Omkar's last class of math, he learned about the least common multiple, or LCM. LCM(a,b) is the smallest positive integer x which 阅读全文
posted @ 2020-08-24 13:13 Luglucky 阅读(219) 评论(0) 推荐(0)
摘要:##题目 Problem Description Now, here is a fuction: F(x) = 6 * x7+8*x6+7x^3+5x^2-y*x (0 ⇐ x ⇐100) Can you find the minimum value when x is between 0 and 阅读全文
posted @ 2020-08-23 23:15 Luglucky 阅读(130) 评论(0) 推荐(0)
摘要:##Problem A ###题面 Acacius is studying strings theory. Today he came with the following problem. You are given a string s of length n consisting of low 阅读全文
posted @ 2020-08-23 22:24 Luglucky 阅读(257) 评论(0) 推荐(0)
摘要:##题目 (戳我)[https://www.luogu.com.cn/problem/P2765] ##思路 两种思路,第一种贪心很明显了,我们直接从第一个开始放球,可以放就放,不能放就新开一个。第二种的话建图,首先我们应该发现这个东西的特点,一个柱子可以放多个球,有多个柱子,但是每个柱子的球是不可 阅读全文
posted @ 2020-08-23 17:43 Luglucky 阅读(162) 评论(0) 推荐(0)
摘要:##题面 戳我 ##思路 有蜥蜴连超级源点,可以出图的连超级汇点,不用说了,然后就是有高度的柱子裂点,边权为高度,然后可以互相跳的连边,跑dinic就好了。 ##代码实现 #include<cstdio> #include<algorithm> #include<vector> #include<q 阅读全文
posted @ 2020-08-22 23:14 Luglucky 阅读(130) 评论(0) 推荐(0)
摘要:##Problem A ###题面 We have a point A with coordinate x=n on OX-axis. We'd like to find an integer point B (also on OX-axis), such that the absolute dif 阅读全文
posted @ 2020-08-22 17:18 Luglucky 阅读(270) 评论(0) 推荐(0)
摘要:##题目 戳我 ##思路 三分图匹配,不过看上去裸匈牙利应该能过吧,我们考虑网络流,但是由于一本书只能匹配一次,那么我们考虑裂点来做流量限制,然后直接跑dinic就好了。 #代码实现 #include<cstdio> #include<algorithm> #include<vector> #inc 阅读全文
posted @ 2020-08-21 21:35 Luglucky 阅读(276) 评论(0) 推荐(0)
摘要:##题目 链接 ##思路 看题目就知道是最小割了,但是不一样的是,我们一般求的最小割是割边,而这题让我们求的是割点,那么我们在原有的网络基础上在每个点和一个我们附加的点上连上一条边权为1的边限制流量就好了。 ##代码实现 #include<cstdio> #include<algorithm> #i 阅读全文
posted @ 2020-08-21 20:24 Luglucky 阅读(139) 评论(0) 推荐(0)
摘要:##最大流 (洛谷 3376) #include<cstdio> #include<algorithm> #include<vector> #include<queue> #include<map> #include<set> #include<iostream> #include<cstring> 阅读全文
posted @ 2020-08-20 22:36 Luglucky 阅读(164) 评论(0) 推荐(0)
摘要:##题目 题目背景 第二次世界大战期间,英国皇家空军从沦陷国征募了大量外籍飞行员。由皇家空军派出的每一架飞机都需要配备在航行技能和语言上能互相配合的两名飞行员,其中一名是英国飞行员,另一名是外籍飞行员。在众多的飞行员中,每一名外籍飞行员都可以与其他若干名英国飞行员很好地配合。 题目描述 一共有 nn 阅读全文
posted @ 2020-08-20 19:53 Luglucky 阅读(167) 评论(0) 推荐(0)
摘要:##problem A ###题意 Let LCM(x,y) be the minimum positive integer that is divisible by both x and y. For example, LCM(13,37)=481, LCM(9,6)=18. You are gi 阅读全文
posted @ 2020-08-20 14:34 Luglucky 阅读(394) 评论(0) 推荐(0)
摘要:##Problem A ###题目 You are given the array a consisting of n positive (greater than zero) integers. In one move, you can choose two indices i and j (i≠ 阅读全文
posted @ 2020-08-16 21:37 Luglucky 阅读(252) 评论(0) 推荐(0)
摘要:##Problem C ###题面 You are given an array a1,a2,…,an consisting of integers from 0 to 9. A subarray al,al+1,al+2,…,ar−1,ar is good if the sum of elemen 阅读全文
posted @ 2020-08-15 14:54 Luglucky 阅读(269) 评论(0) 推荐(0)
摘要:##题目 A binary matrix is called good if every even length square sub-matrix has an odd number of ones. Given a binary matrix a consisting of n rows and 阅读全文
posted @ 2020-08-14 20:43 Luglucky 阅读(82) 评论(0) 推荐(0)
摘要:##题目 Problem Description DZY has a sequence a[1..n]. It is a permutation of integers 1∼n. Now he wants to perform two types of operations: 0lr: Sort a 阅读全文
posted @ 2020-08-14 14:15 Luglucky 阅读(72) 评论(0) 推荐(0)
摘要:##题面 Problem Description John has several lines. The lines are covered on the X axis. Let A is a point which is covered by the most lines. John wants 阅读全文
posted @ 2020-08-14 00:27 Luglucky 阅读(101) 评论(0) 推荐(0)
摘要:##题目 农民约翰正在指挥他的N头牛进行清理工作。 他将一天划分为了T个班次(1~T)。 每头牛都只能在一天中的某一个时间段内进行不间断的工作。 你需要帮助约翰排列出一个合理的奶牛的清理班次,使得每个班次都有奶牛在进行清理,而且动用的奶牛数量可以尽可能的少。 输入格式 第1行:两个空格隔开的整数N和 阅读全文
posted @ 2020-08-11 22:13 Luglucky 阅读(144) 评论(0) 推荐(0)
摘要:##题目 定义 conn(s,n) 为 n 个字符串 s 首尾相接形成的字符串,例如: conn(“abc”,2)=”abcabc” 称字符串 a 能由字符串 b 生成,当且仅当从字符串 b 中删除某些字符后可以得到字符串 a。 例如“abdbec”可以生成“abc”,但是“acbbe”不能生成“a 阅读全文
posted @ 2020-08-11 00:39 Luglucky 阅读(185) 评论(0) 推荐(1)
摘要:##题目 小A和小B决定利用假期外出旅行,他们将想去的城市从1到N编号,且编号较小的城市在编号较大的城市的西边,已知各个城市的海拔高度互不相同,记城市 i 的海拔高度为 Hi。 城市 i 和城市 j 之间的距离 d[i,j] 恰好是这两个城市海拔高度之差的绝对值,即 d[i,j]=|Hi−Hj|。 阅读全文
posted @ 2020-08-10 22:00 Luglucky 阅读(171) 评论(0) 推荐(0)
摘要:##题目 司令部的将军们打算在NM的网格地图上部署他们的炮兵部队。一个NM的地图由N行M列组成,地图的每一格可能是山地(用”H” 表示),也可能是平原(用”P”表示),如下图。 在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示: 阅读全文
posted @ 2020-08-09 22:51 Luglucky 阅读(132) 评论(0) 推荐(0)
摘要:##题目 参与考古挖掘的小明得到了一份藏宝图,藏宝图上标出了n个深埋在地下的宝藏屋,也给出了这n个宝藏屋之间可供开发的m条道路和它们的长度。 小明决心亲自前往挖掘所有宝藏屋中的宝藏。但是,每个宝藏屋距离地面都很远,也就是说,从地面打通一条到某个宝藏屋的道路是很困难的,而开发宝藏屋之间的道路则相对容易 阅读全文
posted @ 2020-08-09 21:46 Luglucky 阅读(137) 评论(0) 推荐(0)
摘要:##题目 This year in Equestria was a year of plenty, so Applejack has decided to build some new apple storages. According to the advice of the farm desig 阅读全文
posted @ 2020-08-08 14:18 Luglucky 阅读(117) 评论(0) 推荐(0)
摘要:##题面 One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but 阅读全文
posted @ 2020-08-08 14:15 Luglucky 阅读(150) 评论(0) 推荐(0)
摘要:##题目 有一个长为 nn 的序列 aa,以及一个大小为 kk 的窗口。现在这个从左边开始向右滑动,每次滑动一个单位,求出每次滑动后窗口中的最大值和最小值。 ##思路 维护一个单调队列即可。 ##代码实现 #include<cstdio> #include<algorithm> #include<v 阅读全文
posted @ 2020-08-07 20:09 Luglucky 阅读(143) 评论(0) 推荐(0)
摘要:##题目 在某个星球上,一天由 N 个小时构成,我们称0点到1点为第1个小时、1点到2点为第2个小时,以此类推。 在第 i 个小时睡觉能够恢复Ui点体力。 在这个星球上住着一头牛,它每天要休息B个小时。 它休息的这B个小时不一定连续,可以分成若干段,但是在每段的第一个小时,它需要从清醒逐渐入睡,不能 阅读全文
posted @ 2020-08-07 16:41 Luglucky 阅读(137) 评论(0) 推荐(0)
摘要:##题目 有一个树形的水系,由 N-1 条河道和 N 个交叉点组成。 我们可以把交叉点看作树中的节点,编号为 1~N,河道则看作树中的无向边。 每条河道都有一个容量,连接 x 与 y 的河道的容量记为 c(x,y)。 河道中单位时间流过的水量不能超过河道的容量。 有一个节点是整个水系的发源地,可以源 阅读全文
posted @ 2020-08-07 12:22 Luglucky 阅读(151) 评论(0) 推荐(0)
摘要:##题目 Problem Description Aphelios likes to play with tree. A weighted tree is an undirected connected graph without cycles and each edge has a weight. 阅读全文
posted @ 2020-08-06 23:26 Luglucky 阅读(178) 评论(0) 推荐(0)
摘要:##题目 学校实行学分制。 每门的必修课都有固定的学分,同时还必须获得相应的选修课程学分。 学校开设了 N 门的选修课程,每个学生可选课程的数量 M 是给定的。 学生选修了这 M 门课并考核通过就能获得相应的学分。 在选修课程中,有些课程可以直接选修,有些课程需要一定的基础知识,必须在选了其他的一些 阅读全文
posted @ 2020-08-06 11:42 Luglucky 阅读(136) 评论(0) 推荐(0)
摘要:##题目 Ural大学有N名职员,编号为1~N。 他们的关系就像一棵以校长为根的树,父节点就是子节点的直接上司。 每个职员有一个快乐指数,用整数 Hi 给出,其中 1≤i≤N。 现在要召开一场周年庆宴会,不过,没有职员愿意和直接上司一起参会。 在满足这个条件的前提下,主办方希望邀请一部分职员参会,使 阅读全文
posted @ 2020-08-05 23:28 Luglucky 阅读(87) 评论(0) 推荐(0)
摘要:##题目 Problem Description Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each r 阅读全文
posted @ 2020-08-05 19:57 Luglucky 阅读(97) 评论(0) 推荐(0)
摘要:##题目 Problem Description 小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互 阅读全文
posted @ 2020-08-05 17:29 Luglucky 阅读(126) 评论(0) 推荐(0)
摘要:##题面 Problem Description Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known th 阅读全文
posted @ 2020-08-05 17:25 Luglucky 阅读(121) 评论(0) 推荐(0)
摘要:##题目 Problem Description As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long histo 阅读全文
posted @ 2020-08-05 17:22 Luglucky 阅读(76) 评论(0) 推荐(0)
摘要:##题面 Generate three integers a, b, and c in [1,n] with equal probability independently, and use them as the three right-angle side length of a right-a 阅读全文
posted @ 2020-08-05 10:24 Luglucky 阅读(174) 评论(0) 推荐(0)
摘要:##题面 虽然探索金字塔是极其老套的剧情,但是有一队探险家还是到了某金字塔脚下。 经过多年的研究,科学家对这座金字塔的内部结构已经有所了解。 首先,金字塔由若干房间组成,房间之间连有通道。 如果把房间看作节点,通道看作边的话,整个金字塔呈现一个有根树结构,节点的子树之间有序,金字塔有唯一的一个入口通 阅读全文
posted @ 2020-08-05 00:06 Luglucky 阅读(149) 评论(0) 推荐(0)
摘要:##题面 “多边形游戏”是一款单人益智游戏。 游戏开始时,给定玩家一个具有N个顶点N条边(编号1-N)的多边形,如图1所示,其中N = 4。 每个顶点上写有一个整数,每个边上标有一个运算符+(加号)或运算符*(乘号)。 第一步,玩家选择一条边,将它删除。 接下来在进行N-1步,在每一步中,玩家选择一 阅读全文
posted @ 2020-08-04 22:08 Luglucky 阅读(143) 评论(0) 推荐(0)
摘要:##题目 圣诞老人共有M个饼干,准备全部分给N个孩子。 每个孩子有一个贪婪度,第 i 个孩子的贪婪度为 g[i]。 如果有 a[i] 个孩子拿到的饼干数比第 i 个孩子多,那么第 i 个孩子会产生 g[i]*a[i]的怨气。 给定N、M和序列g,圣诞老人请你帮他安排一种分配方式,使得每个孩子至少分到 阅读全文
posted @ 2020-08-03 21:14 Luglucky 阅读(159) 评论(0) 推荐(0)
摘要:##题面 一个公司有三个移动服务员,最初分别在位置1,2,3处。 如果某个位置(用一个整数表示)有一个请求,那么公司必须指派某名员工赶到那个地方去。 某一时刻只有一个员工能移动,且不允许在同样的位置出现两个员工。 从 p 到 q 移动一个员工,需要花费 c(p,q)。 这个函数不一定对称,但保证 c 阅读全文
posted @ 2020-08-03 14:10 Luglucky 阅读(132) 评论(0) 推荐(0)
摘要:##题面 给定长度为N的序列A,构造一个长度为N的序列B,满足: 1、B非严格单调,即B1≤B2≤…≤BN或B1≥B2≥…≥BN。 2、最小化 S=∑Ni=1|Ai−Bi|。 只需要求出这个最小值S。 输入格式 第一行包含一个整数N。 接下来N行,每行包含一个整数Ai。 输出格式 输出一个整数,表示 阅读全文
posted @ 2020-08-03 10:53 Luglucky 阅读(175) 评论(0) 推荐(0)
摘要:##题面 有 N 个学生合影,站成左端对齐的 k 排,每排分别有 N1,N2,…,Nk 个人。 (N1≥N2≥…≥Nk) 第1排站在最后边,第 k 排站在最前边。 学生的身高互不相同,把他们从高到底依次标记为 1,2,…,N。 在合影时要求每一排从左到右身高递减,每一列从后到前身高也递减。 问一共有 阅读全文
posted @ 2020-08-02 22:59 Luglucky 阅读(182) 评论(0) 推荐(0)
摘要:##题面 熊大妈的奶牛在小沐沐的熏陶下开始研究信息题目。 小沐沐先让奶牛研究了最长上升子序列,再让他们研究了最长公共子序列,现在又让他们研究最长公共上升子序列了。 小沐沐说,对于两个数列A和B,如果它们都包含一段位置不一定连续的数,且数值是严格递增的,那么称这一段数是两个数列的公共上升子序列,而所有 阅读全文
posted @ 2020-08-02 22:53 Luglucky 阅读(96) 评论(0) 推荐(0)
摘要:##题面 Problem Description Sociologists are interested in the phenomenon of "friendship". To study this property, they analyze various groups of people. 阅读全文
posted @ 2020-08-02 11:23 Luglucky 阅读(177) 评论(0) 推荐(0)
摘要:##题目 You are to write a program that tries to find an optimal coloring for a given graph. Colors are applied to the nodes of the graph and the only av 阅读全文
posted @ 2020-08-01 21:45 Luglucky 阅读(141) 评论(0) 推荐(0)
摘要:##题面 Problem Description The stable marriage problem consists of matching members of two different sets according to the member’s preferences for the 阅读全文
posted @ 2020-08-01 13:18 Luglucky 阅读(113) 评论(0) 推荐(0)