题解

140 条题解

  • 0
    @ 2009-03-04 17:14:16

    orz桥神牛

  • 0
    @ 2009-03-04 15:57:24

    模型明显..

    line tree

  • 0
    @ 2009-03-10 18:10:39

    线段树,要说动态规划的方法,可以用f表示起点为i,长度为2^k区间内的最大值。

    先预处理一下f,然后max(a,b)=max(f[a,k],f),其中k为trunc(log(b-a+1))。

    补充一下f的转移方程:f=max(f,f)

    边界:f=a[i]

  • 0
    @ 2009-03-03 19:39:20

    我靠。。这评测机抽筋抽得不行了。。

  • 0
    @ 2009-03-03 19:25:56

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 9ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:9ms

    用线段数搞一下

  • 0
    @ 2009-03-03 18:34:29

    这不是我应该做的题目...

    我还小...

    等我长大了...

    有了自己的事业...

    有了自己的家庭...

    有了...

    有了...

    有了钱...

    请人做...

  • 0
    @ 2009-03-03 17:28:01

    一楼的真强悍!

  • 0
    @ 2009-03-03 14:18:50

    超经典题目

    用 write 别用writeln 否则后果...

  • 0
    @ 2009-03-03 12:38:13

    yeah!!

    I'm the first!

    extended万岁!!

    居然又用P,55555~~~~

    P.S. 要用write!!

  • 0
    @ 2009-03-02 21:57:56

    果然是囧题

    看到无数大牛啊~

  • 0
    @ 2009-03-08 12:25:19

    用的 Sparse Table (ST) algorithm

    很慢...

    估计是写烂了

  • 0
    @ 2009-07-11 10:32:50

    两种解法

    ST

    线段树

    两个都用过AC了。。。

    新学了线段树,比较happy

  • 0
    @ 2009-03-02 14:54:55

    此题难度为∞,无字难题!

    同意楼上

  • 0
    @ 2009-03-02 00:30:02

    此题难度为∞,无字难题!

  • 0
    @ 2009-03-01 23:37:46

    极野,RMQ啊

  • 0
    @ 2009-03-01 21:40:04

    没有见到题目的说。。。囧

  • 0
    @ 2009-03-10 18:57:42

    注意数列中可能有负数!初始查询需要设成-maxlongint!!!

    别的没什么了,裸的线段树,我第一次写线段树小于100行.(本来想贴代码的)

  • 0
    @ 2009-03-01 21:01:44

    const

    maxn=131072;

    tempt=65536;

    type

    point=record

    x,y:longint;

    end;

    matrix=record

    x1,y1,x2,y2:longint;

    end;

    quene=record

    x,l,r,d:longint;

    end;

    shu=array[0..200000] of int64;

    wh=^wnode;

    wnode=record

    y:longint;

    next:wh;

    end;

    qh=^qnode;

    qnode=record

    k:quene;

    next:qh;

    end;

    var

    a:array[0..400000] of point;

    B,W:array[0..400000] of point;

    H:array[0..400000] of matrix;

    l:array[0..400000] of longint;

    que:array[0..400000] of quene;

    can:array[0..400000] of boolean;

    hash:array[-200000..200000] of wh;

    hh:array[-200000..200000] of qh;

    QQ:array[0..120000] of longint;

    i,j,k,n,m,D:longint;

    min,max:int64;

    P,Q:shu;

    c:array[0..270000] of longint;

    procedure quesort(n:longint);

    var

    i,m:longint;

    k:qh;

    begin

    for i:=1 to n do

    begin

    new(k); k^.k:=que[i]; k^.next:=hh[que[i].x];

    hh[que[i].x]:=k;

    end;

    m:=0;

    for i:=-200000 to 200000 do

    while hh[i]nil do

    begin

    inc(m); que[m]:=hh[i]^.k;

    hh[i]:=hh[i]^.next;

    end;

    end;

    procedure wsort(l,r:longint);

    var

    i,m:longint;

    k:wh;

    begin

    for i:=l to r do

    begin

    new(k); k^.y:=a[i].y; k^.next:=hash[a[i].x-a[i].y];

    hash[a[i].x-a[i].y]:=k;

    end;

    m:=l;

    for i:=-200000 to 200000 do

    while hash[i]nil do

    begin

    a[m].x:=i+hash[i]^.y; a[m].y:=hash[i]^.y;

    inc(m); hash[i]:=hash[i]^.next;

    end;

    end;

    procedure insert(x0,y0,x,y,delta:longint);

    var mid:longint;

    begin

    if (x

  • -1
    @ 2009-03-01 21:02:48

    继续学习SLF和LLL优化

  • -2
    @ 2017-02-03 15:23:51

    裸的不能再裸的RMQ了,WA两个点的注意这题有负数就行了。

信息

ID
1514
难度
6
分类
其他 | RMQ 点击显示
标签
(无)
递交数
4976
已通过
1195
通过率
24%
被复制
3
上传者