摘要:
单调栈与单调队列简单例题 单调栈: POJ3250 题意:有n只奶牛排成一列向右看,每头奶牛只能看到比自己矮的奶牛,即会被高的奶牛挡住后面,问共有多少只奶牛能被看到 思路:考虑每头奶牛能被前面牛看到的次数,也就是从他左边开始单调递减的序列的长度,用单调栈维护即可 代码: c++ include in 阅读全文
摘要:
启发式搜索:A 与IDEA\ 16格拼图为例 题目描述为: The goal of the 15 puzzle problem is to complete pieces on 4×4 cells where one of the cells is empty space. In this prob 阅读全文
摘要:
Poj 2391 Ombrophobic Bovines 网络流 拆点 c++ include include include include include using namespace std; typedef long long ll; const int maxn=500+10; cons 阅读全文