![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
Rocky小鬼66
WYQ?WYQ!WYWYQQQ!!!
展开
-
站队(test05)
Problem: 给定一个长度为n的队列,求它是第几种站队方式(从矮到高认为是第一种,从高到矮认为是最后一种) 1<n<1051<n<10^5 100.0000<ai<200.0000100.0000<a_i<200.0000 Solution: 一看就是康托展开,但由于数据范围我们要对其进行优化,在寻找当前元素是第几位时,O(剩余元素个数)O(剩余元素个数)查找很不优雅,自然我们想到用数原创 2016-09-28 19:37:56 · 336 阅读 · 0 评论 -
[NOIP 2012] 借教室 D2 T2
正解给的是二分。刚做这题一看不是裸线段树吗,结果被卡了OTZ,加读入优化并卡常过的…#include <stdio.h>#include <ctype.h>#define min(a,b) ((a)<(b)?(a):(b))int n,m,room[1000001],x,y,c;struct tree{ int mini,lazy;}node[4000001];char get原创 2016-10-19 15:48:51 · 567 阅读 · 0 评论 -
[ 模板 ] Treap指针版
#include <stdio.h>#include <stdlib.h>struct Treap{ Treap *Lson,*Rson; int val,key,cnt,size; Treap(int num) { Lson = Rson = NULL; val = num; key = rand();原创 2016-11-25 13:36:00 · 584 阅读 · 0 评论 -
[ 模板 ] 线段树区间修改
[NOIP2012] 借教室被卡_ (:3_|<) _ 还是老老实实写正解吧…#include <stdio.h>#include <algorithm>using namespace std;int n,m,room[1000001],x,y,c;struct tree{ int mini,lazy;}node[4000001];void pushup(int rt){原创 2016-10-18 19:29:19 · 265 阅读 · 1 评论