POJ 2796[UVA 1619] Feel Good】的更多相关文章

Feel Good Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 16786   Accepted: 4627 Case Time Limit: 1000MS   Special Judge Description Bill is developing a new mathematical theory for human emotions. His recent investigations are dedicated…
Feel Good   Description Bill is developing a new mathematical theory for human emotions. His recent investigations are dedicated to studying how good or bad days influent people's memories about some period of life. A new idea Bill has recently devel…
Description The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: “Where is the most distant point from the sea?” The answer to this question for Honshu was found in 1996. The mos…
1619 - Feel Good Time limit: 3.000 seconds   Bill is developing a new mathematical theory for human emotions. His recent investigations are dedi- cated to studying how good or bad days in uent people's memories about some period of life. A new idea B…
Bill is developing a new mathematical theory for human emotions. His recent investigations are dedicated to studying how good or bad days influent people's memories about some period of life. A new idea Bill has recently developed assigns a non-negat…
题意:给你许多串字符串,从中提取电话号码,输出出现复数次的电话号码及次数. 以下是我艰难的AC历程:(这题估计是我刷的题目题解次数排前的了...) 题目不是很难理解,刚开始想到用map,但stl的map不是很放心,怕超时.于是放心的用数组敲了.(事实证明我放心过头了) 刚开始在Vjugde里面提交老SE,我还以为uva又挂了,最近各种挂啊... 后来又刷了一题过来提交,还是SE.某大神说这题uva完全挂了,没人能提交得了,只能去poj交,于是屁颠屁颠跑poj给TLE了. 在敲的时候就考虑到用ge…
题目链接:http://poj.org/problem?id=2796 单调栈可以O(n)得到以每个位置为最小值,向左右最多扩展到哪里. #include<cstdio> #include<algorithm> #include<stack> using namespace std; ; int a[maxn]; int l[maxn]; int r[maxn]; long long pre[maxn]; stack< pair<int,int> &g…
中文题 (一般都比较坑) 思路:DFS (感谢学长的幻灯片) 这破题把我折腾惨了!!!搞了n天 // by Sirius_Ren #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n,a[100],sum,jy,maxx,q; bool vis[100]; bool cmp(int a,int b){return a>b;} bool dfs(int…
ZOJhttp://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1914 POJhttp://poj.org/problem?id=2349 UVAhttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1310 题目大意,给定一些点的坐标,求MST,然后要求求去掉最大的k条边后,最大的…
http://poj.org/problem?id=2796 题意:给出n个数,问一个区间里面最小的元素*这个区间元素的和的最大值是多少. 思路:只想到了O(n^2)的做法. 参考了http://www.cnblogs.com/ziyi--caolu/archive/2013/06/23/3151556.html的写法,用单调栈可以优化到O(n). 对于每个元素,维护这个元素向前延伸比它大的有多少个,向后延伸比它小的有多少个.即该元素是处于山谷. 那么如何用单调栈维护这个呢? 首先这个栈是单调递…