Live2d Test Env

随笔分类 -  双指针

摘要:A .DZY Loves Physics 题意:给定带点权和边权的无向图,现在让你选一些点,使得 点权和/被选点对间的边权和 最大。 思路:不难证明,选择边和对应的两点是最优的。 #include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<=b; 阅读全文
posted @ 2019-02-27 22:28 nimphy 阅读(520) 评论(0) 推荐(0) 编辑
摘要:Little Sub loves math very much, and has just come up with an interesting problem when he is working on his geometry homework. It is very kind of him 阅读全文
posted @ 2019-01-19 21:46 nimphy 阅读(520) 评论(0) 推荐(0) 编辑
摘要:5142: [Usaco2017 Dec]Haybale Feast Description Farmer John is preparing a delicious meal for his cows! In his barn, he has NN haybales (1≤N≤100,0 00). 阅读全文
posted @ 2018-11-14 16:03 nimphy 阅读(242) 评论(0) 推荐(0) 编辑
摘要:Description 小Q同学在学习操作系统中内存管理的一种页面置换算法,LRU(LeastRecentlyUsed)算法。 为了帮助小Q同学理解这种算法,你需要在这道题中实现这种算法,接下来简要地介绍这种算法的原理: 1.初始化时,你有一个最大长度为n的空队列,用于暂时存储一些页面的地址。 2. 阅读全文
posted @ 2018-11-14 10:51 nimphy 阅读(240) 评论(0) 推荐(0) 编辑
摘要:We define the distance of two strings A and B with same length n is dis A,B =∑ i=0 n−1 |A i −B n−1−i | disA,B=∑i=0n−1|Ai−Bn−1−i| The difference betwee 阅读全文
posted @ 2018-10-17 20:28 nimphy 阅读(160) 评论(0) 推荐(0) 编辑
摘要:Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by sw 阅读全文
posted @ 2018-08-31 21:30 nimphy 阅读(236) 评论(0) 推荐(0) 编辑
摘要:描述 给定一个NxM的矩阵A和一个整数K,小Hi希望你能求出其中最大(元素数目最多)的子矩阵,并且该子矩阵中所有元素的和不超过K。 输入 第一行包含三个整数N、M和K。 以下N行每行包含M个整数,表示A。 对于40%的数据,1 <= N, M <= 10 对于100%的数据,1 <= N, M <= 阅读全文
posted @ 2018-02-20 17:07 nimphy 阅读(346) 评论(0) 推荐(0) 编辑
摘要:大概是需要前缀和优化DP,和记录左右范围。 还有一道题,没有下手,等做完了,再来总结。 1,数组分拆: 给定数组,问有多少种拆分法,使得每一段和不为0。 (1e5) (用map优化DP) #include<map> #include<cstdio> #include<cstdlib> #includ 阅读全文
posted @ 2018-02-18 18:07 nimphy 阅读(315) 评论(0) 推荐(0) 编辑
摘要:居民迁移 居民迁移 时间限制:3000ms 单点时限:1000ms 内存限制:256MB 描述 公元2411年,人类开始在地球以外的行星建立居住点。在第1326号殖民星上,N个居住点分布在一条直线上。为了方便描述,我们设第i个居住点的位置是Xi,其中居住着Yi位居民。随着冬季的到来,一些人口较多的居 阅读全文
posted @ 2017-11-06 18:59 nimphy 阅读(401) 评论(0) 推荐(0) 编辑
摘要:1599 逆向bfs+优化 #include<cstdio> #include<cstdlib> #include<iostream> #include<cstring> #include<algorithm> #include<string> using namespace std; int a, 阅读全文
posted @ 2017-10-20 15:56 nimphy 阅读(718) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示