按照<算法竞赛进阶指南>写的 哦对了,注意下最后判断,因为开始拓扑的时候,s可能不在里边,所以不一定等于INF,而是应该大于等于INF #include<cstring> #include<iostream> #include<cstdio> #include<algorithm> #include<queue> #include<vector> #define maxn 50000 using namespace std…
题目链接  2017 Beijing Problem H 题意  给定一个$n * m$的矩阵,现在可以把矩阵中的任意一个数换成$p$,求替换之后最大子矩阵的最小值. 首先想一想暴力的方法,枚举矩阵中的数,然后$O(n^{3})$求最大子矩阵更新答案,这样复杂度是$O(n^{5})$的. 思考得再仔细一些,就是包含这个数的最大子矩阵和,以及不包含这个数的最大子矩阵的和的较大值. 设原矩阵中最大子矩阵和为$mx$. 设$u_{i}$为只考虑矩阵前$i$行的最大子矩阵和,$d_{i}$为考虑矩阵第$…
Hierarchical Notation Time Limit: 2 Seconds      Memory Limit: 131072 KB In Marjar University, students in College of Computer Science will learn EON (Edward Object Notation), which is a hierarchical data format that uses human-readable text to trans…
n堆石子 每次只能拿一个石子从一堆移到另一堆  知道所有的堆的石子数目都能整除x(x>1) 问最小移动次数 枚举x的可能取值  即a[i]和的素因子即可  合因子的区间变化会比较大   然后求余 每次都把石子移到余数最大的那一堆,加起来的总和求最小值. 注意 开longlong #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include &l…
题意 等价于给一个数列,每次对一个长度为$K$的连续区间减一 为最多操作多少次 题解: 看样例猜的贪心,10分钟敲了个线段树就交了... 从1开始,找$[i,i+K]$区间的最小值,然后区间减去最小值,答案加上最小值即可... 这个思路,后来我看博客上的总结,应该是没问题的, 可是,依旧不知道线段树写的对不对..因为是假数据... #include <bits/stdc++.h> #define ll long long #define IO ios::sync_with_stdio(fals…
给定两个操作: MULTIPLY L R x  区间里都乘以一个数x MAX L R : 计算区间内一个2,3,5,7个数最大值. 思路:维护4个最大值.蓝瘦. /** 有 n 个数和 5 种操作 add a b c:把区间[a,b]内的所有数都增加 c set a b c:把区间[a,b]内的所有数都设为 c sum a b:查询区间[a,b]的区间和 max a b:查询区间[a,b]的最大值 min a b:查询区间[a,b]的最小值 */ #include <bits/stdc++.h>…
It is my great honour to introduce myself to you here. My name is Aloysius Benjy Cobweb Dartagnan Egbert Felix Gaspar Humbert Ignatius Jayden Kasper Leroy Maximilian. As a storyteller, today I decide to tell you and others a story about the hero Huri…
题目链接 problem description 5 friends play LOL together . Every one should BAN one character and PICK one character . The enemy should BAN 55 characters and PICK 55 characters . All these 2020 heroes must be different . Every one can BAN any heroes by h…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud 下午在HDU上打了一下今年北京区域赛的重现,过了5题,看来单挑只能拿拿铜牌,呜呜. 先将这五题的题解放上来,剩余题目等搞出来再补上 A题 A Curious Matt Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Problem Description T…
2019ICPC银川 作为第一次打区域赛的我,心情异常激动,加上学校给坐飞机(事实上赶飞机很痛苦). 热身赛很难受,oj上不去,写AC自动机输入没写好.. 现场赛,开场直觉倒着看,发现签到.然后看B,先想到了正解,但是不知怎么就去想了另一种解,成功贡献罚时,然后突然就没了思路. 同时换给学长写I,下来和队友想B,这一搞就是一个小时....幸好第二发过了, 两题298名..瞬间自闭.然后队友改I,我跟榜看G,发现G就是个裸线段树. 学长I出现bug了,打印代码下来调,我上去搞G,搞了一半,学长说他…