题解

114 条题解

  • 0
    @ 2009-08-07 13:19:26

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    主程序:

    Begin

    Init;

    Qsort(1, n);

    Main;

    Print;

    End.

    Main部分(比楼上们简单一些):

    Begin

    i := 1; ans := 0;

    Repeat

    j := i; Max := b[i];

    While (a[j+1] n;

    End;

  • 0
    @ 2009-08-07 11:49:45

    type

    re=record

    x:longint;

    y:longint;

    end;

    var

    a:array[1..20001] of re;

    i,j,n,sum:longint;

    procedure qs(h,t:longint);

    var

    i,j,x:longint;

    y:re;

    begin

    i:=h;

    j:=t;

    x:=a[(h+t)shr 1].x;

    repeat

    while a[i].xx do

    dec(j);

    if ij;

    if ih then qs(h,j);

    end;

    begin

    readln(n);

    for i:=1 to n do

    begin

    read(a[i].x);

    readln(a[i].y);

    end;

    qs(1,n);

    for i:=1 to n-1 do

    begin

    if (a[i].x

  • 0
    @ 2009-08-05 21:29:51

    同志们 - - 这道题 要用快排

  • 0
    @ 2009-08-04 16:46:57

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    呜呜~~~~(>_

  • 0
    @ 2009-08-04 09:58:06

    var

    a :array[1..100000]of int64;

    b :array[1..100000]of int64;

    i,j :longint;

    n :longint;

    ans :int64;

    procedure qsort(l,r:longint);

    var

    i,j :longint;

    x,y :int64;

    begin

    i:=l;j:=r;x:=a[(i+j)div 2];

    repeat

    while a[i]x do dec(j);

    if ij;

    if lb[i]) then begin b[i]:=a[i];a:=a[i];continue; end;

    if (a>a[i])and(aa[i])and(a

  • 0
    @ 2009-08-02 17:56:43

    type

    re=record

    x:longint;

    y:longint;

    end;

    var

    a:array[1..20001] of re;

    i,j,n,sum:longint;

    procedure qs(h,t:longint);

    var

    i,j,x:longint;

    y:re;

    begin

    i:=h;

    j:=t;

    x:=a[(h+t)shr 1].x;

    repeat

    while a[i].xx do

    dec(j);

    if ij;

    if ih then qs(h,j);

    end;

    begin

    readln(n);

    for i:=1 to n do

    begin

    read(a[i].x);

    readln(a[i].y);

    end;

    qs(1,n);

    for i:=1 to n-1 do

    begin

    if (a[i].x

  • 0
    @ 2009-07-31 10:36:27

    第一次接触叫做“线段覆盖”的算法

    挺容易理解的

  • 0
    @ 2009-07-29 10:57:40

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

  • 0
    @ 2009-07-22 10:02:41

    快排+线段覆盖(也就是扫一遍啦~~)

    1次AC+0ms

    PS:看完日全食,效率就是高!宇宙次与我力量!!!

  • 0
    @ 2009-07-20 10:27:02

    这猥琐题目,花了我2 yers!!!!!!!!!

  • 0
    @ 2009-07-15 21:49:34

    离散化

    (庆祝第100道AC)!!

  • 0
    @ 2009-07-11 16:24:58

    LX 离散化你不会?

  • 0
    @ 2009-07-07 10:33:09

    怎么用线段树做这题!!!!!!!!!!!!!!!!!!!!!!

  • 0
    @ 2009-06-29 17:42:10

    快排++线段覆盖 = 1次AC

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    var i,j,mid,tmp,tmp2,num,i1,n:longint;

    a,b:array[1..20001] of longint;

    function pd:boolean;

    begin

    pd:=false;

    if b[i]>b[20001] then pd:=true;

    end;

    procedure qs(l,r:longint);

    begin

    i:=l;j:=r;mid:=a[(l+r) div 2];

    repeat

    while a[i]< mid do inc(i);

    while mid < a[j] do dec(j);

    if ij;

    if l < j then qs(l,j);

    if i < r then qs(i,r);

    end;

    begin

    fillchar(a,sizeof(a),0);

    fillchar(b,sizeof(b),0);

    readln(n);

    for i1:= 1 to n do

    readln(a[i1],b[i1]);

    qs(1,n);

    a[20001]:=a[1];b[20001]:=b[1];

    for i:=2 to n do if pd then

    begin

    if (a[i]b[20001]) then

    begin

    num:=a[i]-b[20001];

    a[20001]:=a[20001]+num;

    b[20001]:=b[i];

    continue;

    end;

    end;

    writeln(b[20001]-a[20001]);

    end.

  • 0
    @ 2009-06-12 22:22:17

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

  • 0
    @ 2009-07-31 10:42:02

    冬 天 不 冷

    program ex;

    var i,n,z,d,x,j:longint;

      a,b,c:array[1..1000000] of longint;

    begin

    readln(n);z:=0;d:=0;x:=0;

    for i:=1 to n do

    begin

      readln(a[i],b[i]);

      if (a[i]>b[i]) and (a[i]>=d) then d:=a[i]

       else if (b[i]>a[i]) and (b[i]>=d) then d:=b[i];

      if (b[i]

  • 0
    @ 2009-05-16 12:06:32

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    用希尔法也可以过(附希尔法)

    jump := n ;

    while jump > 1 do begin

    jump := jump div 2 ;

    repeat

    f := true ;

    for i := 1 to n-jump do

    if a > a then begin

    t := a ; a := a; a := t ;

    t := a ; a := a; a := t ;

    f := false ;

    end;

    until f = true ;

    end;

  • 0
    @ 2009-05-09 19:50:00

    void work()

    {

    int b=a[1].b,e=a[1].e,L=0;

    bool ok=0;

    for(int i=2;i

  • 0
    @ 2009-04-27 13:17:02

    program p1165(input,output);

    var

    a,b:array[1..100000] of longint;

    i,j,n,y:longint;

    t:qword;

    procedure kp(h,t:longint);

    var

    i,j,x,y:longint;

    begin

    i:=h;

    j:=t;

    x:=a[h];

    y:=b[h];

    while i

  • 0
    @ 2009-04-07 19:15:32

    译通过...

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

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

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

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

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

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

    ├ 测试数据 07:答案错误... ├ 标准行输出

     ├ 错误行输出

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

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

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

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

    Unaccepted 有效得分:90 有效耗时:0ms

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

    怎么只有90?

    var

    a,b:array[1..20000]of longint;

    i,j,t,n:longint;

    procedure sort(l,r:longint);

    var

    mid,m,i,j:longint;

    begin

    i:=l;

    j:=r;

    mid:=a[(i+j) div 2];

    repeat

    while a[i]mid do dec(j);

    if ij ;

    if i

信息

ID
1165
难度
6
分类
模拟 点击显示
标签
递交数
3238
已通过
939
通过率
29%
被复制
14
上传者