题解

116 条题解

  • 0
    @ 2009-10-12 15:26:03

    编译通过...

    ├ 测试数据 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-10-05 16:14:49

    #include

    #include

    #include

    using namespace std;

    int N,cnt=0;

    const int maxn=200;

    long long X[maxn],Y[maxn],ans=0;

    int PX[maxn],PY[maxn];

    struct point

    {

    int x,y;

    };

    struct rec

    {

    point a,b;

    }R[maxn];

    void init()

    {

    cin>>N;

    for(int i=0;i>x1>>y1>>x2>>y2;

    X[cnt]=x1;Y[cnt]=y1;

    R[i].a.x=cnt;R[i].a.y=cnt;cnt++;

    X[cnt]=x2;Y[cnt]=y2;

    R[i].b.x=cnt;R[i].b.y=cnt;cnt++;

    }

    }

    bool cmpX(const int&x,const int&y)

    {return X[x]

  • 0
    @ 2009-10-01 09:51:36

    Const Maxn=200;

    Var opt:array[1..Maxn]of record

    dx,dy,ux,uy:int64;

    end;

    n,i:longint;

    ans:int64;

    Procedure cut(x1,y1,x2,y2:int64;t:longint);

    begin

    if (x1>x2) or (y1>y2) then exit;

    while (t>=1) and ((x1>=opt[t].ux)

    or (x2=opt[t].uy)or (y2

  • 0
    @ 2009-09-23 23:20:08

    离散化还是不太懂,不过这题离散化太复杂了,直接矩形切割不就好了。

    Const Maxn=200;

    Var opt:array[1..Maxn]of record

    dx,dy,ux,uy:int64;

    end;

    n,i:longint;

    ans:int64;

    Procedure cut(x1,y1,x2,y2:int64;t:longint);

    begin

    if (x1>x2) or (y1>y2) then exit;

    while (t>=1) and ((x1>=opt[t].ux)

    or (x2=opt[t].uy)or (y2

  • 0
    @ 2009-10-25 18:21:59

    ans := ans + int64(x-x[i])*int64(y[j+1]-y[j])

    不然死的很惨

    http://hi.baidu.com/%C4%BE%D7%D3%C8%D5%D4%C8/blog/item/a09a8f30818ec713eac4af25.html

  • 0
    @ 2009-09-12 23:23:05

    离散化、领悟点皮毛、

  • 0
    @ 2009-09-12 13:40:13

    我也认为4点有误 我在输入时判断矩形存在 就对了

  • 0
    @ 2009-09-08 13:02:57

    做矩形切割时一定要加

    if (dx>=ux) or (dy>=uy) then exit;

    否则第四点WA。。。

  • 0
    @ 2009-09-05 16:49:59

    编译通过...

    ├ 测试数据 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-25 20:51:00

    第四个点 有问题 :

    某个坐标 不 符合 先左下角 再 右下角 , 无视之=AC

    扫描线+离散化: O(N^2*logN)

  • 0
    @ 2009-08-21 16:02:09

    坐标一定要开int64!!!!!!!!!!!!!!!!!!!!!!!

  • 0
    @ 2009-08-20 08:15:20

    坚持不cheat,交了18遍,终于AC。

  • 0
    @ 2009-08-19 17:35:48

    同样矩形切割....

    第4点答案错误....

    标准输出1939 我的是1639...

    没办法 cheat

  • 0
    @ 2009-08-20 08:12:52

    好纯的矩形切割

    一次0msAC

    第四点数据应该无错……

  • 0
    @ 2009-08-15 17:42:38

    第四个点有问题吧~

    好像给出了一个坐标大小不符合的答案~

    加上if (tp.x2

  • 0
    @ 2009-08-12 11:53:52

    终于....出来了

    TNND,怎么坐标都要用int64........

    郁闷,好不容易学会了矩形切割,结果又WA了两次...

    一定要注意!in64

  • 0
    @ 2009-07-22 09:38:07

    太猥琐了,cheat了第四点,用的矩形切割,也还check了

  • 0
    @ 2009-06-08 00:52:44

    嗯,第一次写离散化,很丑地写了167行代码-_-b

    幸亏本题数据量小,不然根本没精力再去优化它了~

    需要注意的是要用int64

  • 0
    @ 2009-05-10 14:26:08

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    long long cover(int x1,int y1,int x2,int y2,int no)

    {

    // fprintf(fout,"%d %d %d %d\n",x1,y1,x2,y2);

    if(no==0) return ((long long)x2-(long long)x1)*((long long)y2-(long long)y1);

    if(x1>=a[no].x1&&x2=a[no].y1&&y2=a[no].y2||y2

  • 0
    @ 2009-04-19 21:40:09

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

    用分割矩形方法的朋友们,如果第2,3两个点错了:

    一定要判段这一区间内是否能够成矩形!

信息

ID
1056
难度
7
分类
计算几何 点击显示
标签
(无)
递交数
3272
已通过
747
通过率
23%
被复制
11
上传者