ACM算法
文章平均质量分 67
bao___zi
ACM 弱鸡一枚
What this era lacks is not the person who is perfect but the person who is with virtue, justice, courage and compassion.
展开
-
tokitsukaze and Soldier【优先队列】
题目链接题目描述 在一个游戏中,tokitsukaze需要在n个士兵中选出一些士兵组成一个团去打副本。 第i个士兵的战力为v[i],团的战力是团内所有士兵的战力之和。 但是这些士兵有特殊的要求:如果选了第i个士兵,这个士兵希望团的人数不超过s[i]。(如果不选第i个士兵,就没有这个限制。) tokitsukaze想知道,团的战力最大为多少。输入描述:第一行包含一个正整数n(1≤n≤10^5)。接下来n行,每行包括2个正整数v,s(1≤v≤10^9,1≤s≤n)。输出描述:输出一个正整数,原创 2022-05-14 09:52:09 · 171 阅读 · 0 评论 -
[HNOI2015]菜肴制作 [图论基础]
题目连接题目描述 知名美食家小A被邀请至ATM 大酒店,为其品评菜肴。 ATM 酒店为小 A 准备了 N 道菜肴,酒店按照为菜肴预估的质量从高到低给予1到N的顺序编号,预估质量最高的菜肴编号为1。 由于菜肴之间口味搭配的问题,某些菜肴必须在另一些菜肴之前制作,具体的,一共有 M 条形如”i 号菜肴’必须’先于 j 号菜肴制作“的限制,我们将这样的限制简写为<i,j>。 现在,酒店希望能求出一个最优的菜肴的制作顺序,使得小 A能尽量先吃到质量高的菜肴:也就是说, (1)在满足所有限制的原创 2022-04-30 10:57:03 · 292 阅读 · 0 评论 -
最短路【洛谷P4366】
最短路原创 2022-04-29 19:17:04 · 387 阅读 · 0 评论 -
C语言创建指针二叉树
#include<stdio.h>#include<stdlib.h>#include<algorithm>using namespace std;const int N = 1e4;typedef struct node{ int data; struct node* left; struct node* right;}Node;Node *tree;void preorder(Node *node){ if(nod.原创 2021-04-14 11:32:18 · 153 阅读 · 0 评论 -
cf1004C Sonya and Robots
Since Sonya is interested in robotics too, she decided to construct robots that will read and recognize numbers.Sonya has drawn n numbers in a row, ai is located in the i-th position. She also has put...原创 2018-07-07 10:39:15 · 218 阅读 · 0 评论 -
Codeforces 1006B Polycarp's Practice
Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a1,a2,…,an, respectively. His plan is to practice for exactly k days. Each day he has to solve at least ...原创 2018-07-23 16:24:46 · 335 阅读 · 0 评论 -
树链基础知识
“在一棵树上进行路径的修改、求极值、求和”乍一看只要线段树就能轻松解决,实际上,仅凭线段树是不能搞定它的。我们需要用到一种貌似高级的复杂算法——树链剖分。 树链,就是树上的路径。剖分,就是把路径分类为重链和轻链。 记siz[v]表示以v为根的子树的节点数,dep[v]表示v的深度(根深度为1),top[v]表示v所在的链的顶端节点,fa[v]表示v的父亲,son[v]表示与v在同一重链上的...原创 2018-06-22 10:55:29 · 1262 阅读 · 0 评论 -
Codeforces 931C Laboratory Work
Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value to lower the error.Kirill has already made his meas...原创 2018-03-05 22:44:51 · 592 阅读 · 0 评论 -
HDU 1074 状态压缩DP入门(1)
Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in t...原创 2018-03-12 21:32:19 · 189 阅读 · 1 评论 -
Codeforces 931D Peculiar apple-tree
In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence n...原创 2018-03-05 16:20:48 · 576 阅读 · 0 评论 -
Codeforces 937B Vile Grasshoppers
The weather is fine today and hence it's high time to climb the nearby pine and enjoy the landscape.The pine's trunk includes several branches, located one above another and numbered from 2 to...原创 2018-03-04 09:31:24 · 432 阅读 · 0 评论 -
Codeforces 937C--Save Energy!
Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.During cooking, Julia goes to the ki...原创 2018-03-03 13:50:14 · 442 阅读 · 1 评论