Live2d Test Env

03 2018 档案

摘要:BZOJ2631 LCT 链上的lazy操作有加法和乘法操作。 (需要解决顺序问题) BZOJ3514 LCT 问第L条边到R条边着写无向边可以组成多少个连通块 LCT 问删除第L到第R条边之后组成多少个连通块 并查集。 BZOJ4259(4503) FFT: 问两个带*号的串,*处可以不相同,问B 阅读全文
posted @ 2018-03-30 11:31 nimphy 阅读(144) 评论(0) 推荐(0) 编辑
摘要:描述 一日,崔克茜来到小马镇表演魔法。 其中有一个节目是开锁咒:舞台上有 n 个盒子,每个盒子中有一把钥匙,对于每个盒子而言有且仅有一把钥匙能打开它。初始时,崔克茜将会随机地选择 k 个盒子用魔法将它们打开。崔克茜想知道最后所有盒子都被打开的概率,你能帮助她回答这个问题吗? 输入 第一行一个整数 T 阅读全文
posted @ 2018-03-29 19:46 nimphy 阅读(401) 评论(0) 推荐(0) 编辑
摘要:例一:CodeForces76A: 题意: 给定N点M边的无向连通图,每条边有两个权值(g,s)。 给定G,S。 让你给出一组(g0,s0)使得图中仅留下g<=g0, s<=s0的边之后,依然连通,并求G*g0+S*s0的最小值。 n<=200,m<=50000。 思路:要生成最小生成树,我们选择的 阅读全文
posted @ 2018-03-28 20:11 nimphy 阅读(344) 评论(0) 推荐(0) 编辑
摘要:3月27 日生日(华理)。 4月1 ‘日’蓝桥杯(华师); 4月15‘日’金马五校(上大?)。 蓝桥杯一定要稳住啊,毕竟准备了这么久,手感一直还不错;但求小题(补齐代码)里面不要考指针。 蓝桥杯在华师,比完去献血 纪念一下。 五校要被大佬吊打啦。。。啦啦啦。只求rp++得个二等奖啊。 4-16日,开 阅读全文
posted @ 2018-03-27 19:51 nimphy 阅读(258) 评论(0) 推荐(0) 编辑
摘要:题意:给定一个N*M的矩阵,每个格子的人可以学文或者学理,学文和学理各有一个满意度,如果以某人为中心的十字内所有人都学文或者学理都会得到一个额外满意度,求最大满意度之和。 思路:BZOJ上面有很多此类题型,用网络里解决的方案大概有两种。 解法1:直接建图求最大流,源点S为学理,汇点T为学文。然后对于 阅读全文
posted @ 2018-03-27 08:47 nimphy 阅读(398) 评论(0) 推荐(0) 编辑
摘要:思路:orzpopoqqq。假定全部在A里,然后去找增广流。 如果很好地理解了用最大流求最大闭合权图的话,就不难想通。 最大闭合权图:原点与代价点连接,收益点与汇点连接; 收益和-最大流=最大净收益。 那么现在的基本代价或者收益是ai-bi,。然后破坏集合的代价是c1i,得到集合的收益是c2i。 差 阅读全文
posted @ 2018-03-26 20:46 nimphy 阅读(366) 评论(0) 推荐(0) 编辑
摘要:思路:二分答案,然后最大流。 建图:对于每个男生,拆成两个点A,B(而且A给B分流,流量为K):A用来连接喜欢的女生,B用来连接不喜欢的女生。很明显,二分到num时,给个A拥有num的流量,B拥有K流量。 同理:女生那里也要拆点。并且,男生流出的流和女生进入的流都要加num的限制。 阅读全文
posted @ 2018-03-26 19:21 nimphy 阅读(209) 评论(0) 推荐(0) 编辑
摘要:题意:从家(1)到学校(N),每条边有自己的长度和代价。现在需要删去一些边,使得最短路比原来大,求删去边的最小代价。 思路:把最短路上的边放入新图中,然后源点为1,汇点为N,求最小割即可。 数据小,时间多,暴力一点都无所谓。 阅读全文
posted @ 2018-03-26 17:03 nimphy 阅读(361) 评论(0) 推荐(0) 编辑
摘要:lxhgww最近迷上了一款游戏,在游戏里,他拥有很多的装备,每种装备都有2个属性,这些属性的值用[1,10000]之间的数表示。当他使用某种装备时,他只能使用该装备的某一个属性。并且每种装备最多只能使用一次。 游戏进行到最后,lxhgww遇到了终极boss,这个终极boss很奇怪,攻击他的装备所使用 阅读全文
posted @ 2018-03-26 09:31 nimphy 阅读(148) 评论(0) 推荐(0) 编辑
摘要:在遥远的东方,有一个神秘的民族,自称Y族。他们世代居住在水面上,奉龙王为神。每逢重大庆典, Y族都 会在水面上举办盛大的祭祀活动。我们可以把Y族居住地水系看成一个由岔口和河道组成的网络。每条河道连接着 两个岔口,并且水在河道内按照一个固定的方向流动。显然,水系中不会有环流(下图描述一个环流的例子)。 阅读全文
posted @ 2018-03-26 09:09 nimphy 阅读(571) 评论(0) 推荐(0) 编辑
摘要:著名游戏设计师vfleaking,最近迷上了Nim。普通的Nim游戏为:两个人进行游戏,N堆石子,每回合可以取其中某一堆的任意多个,可以取完,但不可以不取。谁不能取谁输。这个游戏是有必胜策略的。于是vfleaking决定写一个玩Nim游戏的平台来坑玩家。为了设计漂亮一点的初始局面,vfleaking 阅读全文
posted @ 2018-03-25 17:25 nimphy 阅读(239) 评论(0) 推荐(0) 编辑
摘要:您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作:翻转一个区间,例如原有序序列是5 4 3 2 1,翻转区间是[2,4]的话,结果是5 2 3 4 1 Input 第一行为n,m n表示初始序列有n个数,这个序列依次是(1,2……n-1,n) m表示翻转操作次数接下来 阅读全文
posted @ 2018-03-25 11:30 nimphy 阅读(238) 评论(0) 推荐(0) 编辑
摘要:给出N个数,要求把其中重复的去掉,只保留第一次出现的数。 例如,给出的数为1 2 18 3 3 19 2 3 6 5 4,其中2和3有重复,去除后的结果为1 2 18 3 19 6 5 4。 Input 输入第一行为正整数T,表示有T组数据。 接下来每组数据包括两行,第一行为正整数N,表示有N个数。 阅读全文
posted @ 2018-03-25 10:26 nimphy 阅读(239) 评论(0) 推荐(1) 编辑
摘要:You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number 阅读全文
posted @ 2018-03-22 19:12 nimphy 阅读(259) 评论(0) 推荐(0) 编辑
摘要:在平面直角坐标系中给定N个圆。已知这些圆两两没有交点,即两圆的关系只存在相离和包含。求这些圆的异或面 积并。异或面积并为:当一片区域在奇数个圆内则计算其面积,当一片区域在偶数个圆内则不考虑。 Input 第一行包含一个正整数N,代表圆的个数。接下来N行,每行3个非负整数x,y,r,表示一个圆心在(x 阅读全文
posted @ 2018-03-22 17:41 nimphy 阅读(525) 评论(0) 推荐(0) 编辑
摘要:您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作:1. 插入x数2. 删除x数(若有多个相同的数,因只删除一个)3. 查询x数的排名(若有多个相同的数,因输出最小的排名)4. 查询排名为x的数5. 求x的前驱(前驱定义为小于x,且最大的数)6. 求x的后继(后继定义为大于x 阅读全文
posted @ 2018-03-22 11:31 nimphy 阅读(243) 评论(0) 推荐(0) 编辑
摘要:1,有两种DP,复杂度都是O(N^2),但是浪费的侧重点不同,所以根据侧重点分块DP,复杂度可以降到O(N^1.5)。 2,母函数+五边形blabla。。。 占位。 其实就是母函数拆开后,快速知道哪些X^N=哪些X^M*X^(N-M)。然后就可以递推了。 阅读全文
posted @ 2018-03-19 21:30 nimphy 阅读(214) 评论(0) 推荐(0) 编辑
摘要:Input Output Sample Input 由公式,ans=2^(N-1)%Mod=2^((N-1)%(Mod-1)+(Mod-1)) %Mod。 注意:降幂的之后再加一个Mod-1保险,避免为负,比如此题出入1000000006时,就出问题了。 阅读全文
posted @ 2018-03-19 20:23 nimphy 阅读(248) 评论(0) 推荐(0) 编辑
摘要:关键词:并查集,二分图,树剖,树上差分,LCA,搜索。 例题一: CodeForces-85E:Guard Towers 题意:给定平面上N个点(N<=5000),以及N个点的坐标。现在可以把每个点染成红色或者蓝色。求最小化同色点的最大距离,且求出相应的方案数。 思路:二分答案L,把距离大于等于L的 阅读全文
posted @ 2018-03-18 16:30 nimphy 阅读(697) 评论(0) 推荐(0) 编辑
摘要:The Little Elephant loves strings very much. He has an array a from n strings, consisting of lowercase English letters. Let's number the elements of t 阅读全文
posted @ 2018-03-17 22:33 nimphy 阅读(522) 评论(0) 推荐(0) 编辑
摘要:题目:CodeForces196-D:The Next Good String 题意:给定仅由小写字母组成的字符串S和一个正整数m。求一个长度与S相同的仅由小写字母组成的字符串S1,满足: S1的字典序>S的字典序 S1中不含长度大于等于d的回文串。 思路:许昊然的文章里叫“逐位确定法”,以为之前没 阅读全文
posted @ 2018-03-17 19:57 nimphy 阅读(331) 评论(3) 推荐(0) 编辑
摘要:Rubik is very keen on number permutations. A permutation a with length n is a sequence, consisting of n different numbers from 1 to n. Element number  阅读全文
posted @ 2018-03-17 11:13 nimphy 阅读(470) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.nowcoder.com/acm/contest/70/D 题目: 定义一个数字为幸运数字当且仅当它的所有数位都是4或者7。 比如说,47、744、4都是幸运数字而5、17、467都不是。 现在想知道在1...n的第k小的排列中,有多少个幸运数字所在的位置的序号也是幸运 阅读全文
posted @ 2018-03-16 23:52 nimphy 阅读(723) 评论(0) 推荐(0) 编辑
摘要:Police headquarter is monitoring signal on different frequency levels. They have got two suspiciously encoded strings s1 and s2 from two different fre 阅读全文
posted @ 2018-03-15 23:21 nimphy 阅读(419) 评论(0) 推荐(0) 编辑
摘要:You are given n segments on a line. There are no ends of some segments that coincide. For each segment find the number of segments it contains. Input 阅读全文
posted @ 2018-03-15 21:09 nimphy 阅读(396) 评论(2) 推荐(0) 编辑
摘要:Devu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a single box are of t 阅读全文
posted @ 2018-03-15 20:42 nimphy 阅读(540) 评论(0) 推荐(0) 编辑
摘要:Times:5000ms; Memory limit:262144 kB 给定字符串S(|S|<=5000),下标由1开始。然后Q个问题(Q<=1e6),对于每个问题,给定L,R,回答区间[L,R]里有多少个回文串。 请想出两种或者以上的方法。 分界线 方法1:区间DP。 容斥一下,dp[i][j] 阅读全文
posted @ 2018-03-14 21:00 nimphy 阅读(176) 评论(0) 推荐(0) 编辑
摘要:Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game 阅读全文
posted @ 2018-03-14 16:43 nimphy 阅读(337) 评论(0) 推荐(0) 编辑
摘要:Ivan has n different boxes. The first of them contains some balls of n different colors. Ivan wants to play a strange game. He wants to distribute the 阅读全文
posted @ 2018-03-14 16:01 nimphy 阅读(534) 评论(0) 推荐(0) 编辑
摘要:Today Pari and Arya are playing a game called Remainders. Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the 阅读全文
posted @ 2018-03-13 17:51 nimphy 阅读(402) 评论(0) 推荐(1) 编辑
摘要:Sereja has a bracket sequence s1, s2, ..., sn, or, in other words, a string s of length n, consisting of characters "(" and ")". Sereja needs to answe 阅读全文
posted @ 2018-03-13 10:56 nimphy 阅读(485) 评论(0) 推荐(0) 编辑
摘要:Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is l 阅读全文
posted @ 2018-03-12 20:59 nimphy 阅读(274) 评论(0) 推荐(0) 编辑
摘要:To stay woke and attentive during classes, Karen needs some coffee! Karen, a coffee aficionado, wants to know the optimal temperature for brewing the 阅读全文
posted @ 2018-03-12 19:16 nimphy 阅读(375) 评论(0) 推荐(0) 编辑
摘要:We already know of the large corporation where Polycarpus works as a system administrator. The computer network there consists of n computers and m ca 阅读全文
posted @ 2018-03-12 16:30 nimphy 阅读(331) 评论(0) 推荐(0) 编辑
摘要:Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to the second soldier. Then the second one t 阅读全文
posted @ 2018-03-12 15:42 nimphy 阅读(253) 评论(0) 推荐(0) 编辑
摘要:Mad scientist Mike has constructed a rooted tree, which consists of n vertices. Each vertex is a reservoir which can be either empty or filled with wa 阅读全文
posted @ 2018-03-12 08:45 nimphy 阅读(255) 评论(0) 推荐(0) 编辑
摘要:描述 给定N个正整数A1, A2, ... AN。 小Hi希望你能从中选出M个整数,使得它们的乘积末尾有最多的0。 输入 第一行包含两个个整数N和M。 第二行包含N个整数A1, A2, ... AN。 对于30%的数据,1 ≤ M ≤ N ≤ 12 对于100%的数据,1 ≤ M ≤ N ≤ 100 阅读全文
posted @ 2018-03-11 17:02 nimphy 阅读(795) 评论(0) 推荐(0) 编辑
摘要:描述 HIHO银行等待区有一排N个座位,从左到右依次编号1~N。现在有M位顾客坐在座位上,其中第i位坐在编号Ai的座位上。 之后又陆续来了K位顾客,(K + M ≤ N) 他们都会选择坐在最"舒适"的空座位上,并且过程中没有顾客离开自己的座位。 最"舒适"的定义是: 1. 对于一个座位,我们将它左边 阅读全文
posted @ 2018-03-11 16:52 nimphy 阅读(647) 评论(2) 推荐(0) 编辑
摘要:【A:HDU2032 杨辉三角】: 简单的递推,或者是基础的DP; 但是只有杨润东一个人1A,整体准确率只有8/37,具体原因不详。 经验:提交前一定要试一下比较特殊的数据或者最大的数据。其次,为了保险,一定要严格按照格式来输出。 最后,数组最好定义为全局变量,i,j等定义为局部变量。 #inclu 阅读全文
posted @ 2018-03-11 15:48 nimphy 阅读(159) 评论(0) 推荐(0) 编辑
摘要:Recently in school Alina has learned what are the persistent data structures: they are data structures that always preserves the previous version of i 阅读全文
posted @ 2018-03-11 11:23 nimphy 阅读(226) 评论(0) 推荐(0) 编辑
摘要:之前有过区域赛,简化版问题: 给定一个小写字符组成的字符串S,(|S|<1e5,下标从1开始),现在有Q种操作,对于每个操作Q(Q<=1e5),输入opt, 如果opt==1,输入x,c,表示把S[x]改为c,(c是小写字母)。 如果opt==2,输入L,R,和字符串T,输出S[L-R]中有多少个字 阅读全文
posted @ 2018-03-10 21:48 nimphy 阅读(478) 评论(0) 推荐(0) 编辑
摘要:Mr. Fib is a mathematics teacher of a primary school. In the next lesson, he is planning to teach children how to add numbers up. Before the class, he 阅读全文
posted @ 2018-03-10 20:05 nimphy 阅读(598) 评论(0) 推荐(0) 编辑
摘要:Median Sum You are given N integers A1, A2, ..., AN. Consider the sums of all non-empty subsequences of A. There are 2N−1 such sums, an odd number. Le 阅读全文
posted @ 2018-03-10 17:43 nimphy 阅读(361) 评论(0) 推荐(0) 编辑
摘要:Each of Farmer John's N cows (1 ≤ N ≤ 1,000) produces milk at a different positive rate, and FJ would like to order his cows according to these rates 阅读全文
posted @ 2018-03-10 13:57 nimphy 阅读(260) 评论(0) 推荐(0) 编辑
摘要:题意:求有向图里面有多少个三元环。 思路:枚举起点A,遍历A可以到的B,然后求C的数量,C的数量位B可以到是地方X集合,和可以到A的地方Y集合的交集(X&Y)。 B点可以枚举,也可以遍历。(两种都试过,区别不大。) 枚举代码: 遍历代码: 阅读全文
posted @ 2018-03-10 10:41 nimphy 阅读(375) 评论(0) 推荐(0) 编辑
摘要:You are given N sets, the i-th set (represent by S(i)) have C(i) element (Here "set" isn't entirely the same as the "set" defined in mathematics, and 阅读全文
posted @ 2018-03-10 09:33 nimphy 阅读(658) 评论(0) 推荐(0) 编辑
摘要:In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumulative average is defined to be . Given your test 阅读全文
posted @ 2018-03-07 23:06 nimphy 阅读(222) 评论(0) 推荐(0) 编辑
摘要:时间限制:4000ms 单点时限:4000ms 内存限制:256MB 时间限制:4000ms 单点时限:4000ms 内存限制:256MB 描述 你知道KMP吗?它是用于判断一个字符串是否是另一个字符串的子串的算法。今天我们想去扩展它。 在信息理论中,在两个相同长度的字符串之间的海明码距离是:两个字 阅读全文
posted @ 2018-03-07 19:22 nimphy 阅读(421) 评论(0) 推荐(0) 编辑
摘要:先放代码。 下标从1开始。 #include<cstdio> #include<iostream> #include<cstring> using namespace std; const int N = 101010; int next[N],extand[N]; char S[N],T[N]; 阅读全文
posted @ 2018-03-07 16:37 nimphy 阅读(200) 评论(0) 推荐(0) 编辑
摘要:一题题目: 一题题解: 这个题目哪来入门再好不过了,支老板之前没有接触过这个东西,然后一点即通:就是把一个int(32位)拆成32个只放0或1的位置,然后这32个的单点操作或者32个一起操作的复杂度是O(1),所以长度位N的bitset的一次单点操作是O(1),整体操作是O(N/w),其中w=32。 阅读全文
posted @ 2018-03-06 23:06 nimphy 阅读(557) 评论(0) 推荐(0) 编辑
摘要:Z国的骑士团是一个很有势力的组织,帮会中汇聚了来自各地的精英。他们劫富济贫,惩恶扬善,受到社会各界的赞扬。最近发生了一件可怕的事情,邪恶的Y国发动了一场针对Z国的侵略战争。战火绵延五百里,在和平环境中安逸了数百年的Z国又怎能抵挡的住Y国的军队。于是人们把所有的希望都寄托在了骑士团的身上,就像期待有一 阅读全文
posted @ 2018-03-05 22:24 nimphy 阅读(217) 评论(0) 推荐(0) 编辑
摘要:Chinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has his own lucky number L. Now he wants to construct his luck 阅读全文
posted @ 2018-03-04 16:02 nimphy 阅读(313) 评论(0) 推荐(0) 编辑
摘要:A friend of yours has taken the job of security officer at the Star-Buy Company, a famous depart- ment store. One of his tasks is to install a video s 阅读全文
posted @ 2018-03-04 12:59 nimphy 阅读(153) 评论(0) 推荐(0) 编辑
摘要:Being the only living descendant of his grandfather, Kamran the Believer inherited all of the grandpa's belongings. The most valuable one was a piece 阅读全文
posted @ 2018-03-04 11:34 nimphy 阅读(290) 评论(0) 推荐(0) 编辑
摘要:Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he wou 阅读全文
posted @ 2018-03-04 10:54 nimphy 阅读(931) 评论(0) 推荐(1) 编辑

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