摘要: 这题是典型的单调队列,百度一下,堆、线段树、树状数组、稀疏表……我通通不会。只好抄了一个纯粹的用数组模拟的算法,脑细胞阵亡无数,才算理解了。 1 #include<stdio.h> 2 #define maxn 1000001 3 int min_1[maxn],max_1[maxn],a[maxn],n,k; 4 void get_max() 5 { 6 int i,start=1,end=1; 7 for(i=1;i<k;i++) 8 { 9 while(a[max_1[end]]<a[i]&&end>=start)10 en... 阅读全文