讨论 / ???评测机出了问题??
lxl-c++ 2011-12-13 04:08:00
点我顶贴 收藏 删除
同样的程序

n才10000啊

难道评测机卡机了??

#include <iostream>

#include <stdio.h>

using namespace std;

int main()

{

int a[10001],b[10001],c[10001],d[10001];

int i,j,k,l,m,n,x,y,ans;

ans=-1;

scanf("%d",&n);

for (i=1; i<=n; i++)

{

scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]);

}

scanf("%d%d",&x,&y);

for (i=1; i<=n; i++)

{

if ((x>=a[i])&&(x<=a[i]+c[i])&&(y>=b[i])&&(y<=b[i]+d[i]))

{

ans=i;

};

}

printf("%d",ans);

return 0;

}

题目:[NOIP2011]铺地毯

状态: Unaccepted

测评机: Xeost[5]

得分: 80分

提交日期: 2011-12-11 11:53:00

有效耗时: 422毫秒

测试结果1: 选手程序运行超过时限

测试结果2: 测试结果错误.错误结果为:1

正确结果应为:2

测试结果3: 通过本测试点|有效耗时47ms

测试结果4: 通过本测试点|有效耗时47ms

测试结果5: 通过本测试点|有效耗时46ms

测试结果6: 通过本测试点|有效耗时47ms

测试结果7: 通过本测试点|有效耗时47ms

测试结果8: 通过本测试点|有效耗时63ms

测试结果9: 通过本测试点|有效耗时62ms

测试结果10: 通过本测试点|有效耗时63ms

状态: Accepted

测评机: Xeost[5]

得分: 100分 [我要评价一下题目~]

提交日期: 2011-12-11 11:55:00

有效耗时: 531毫秒

测试结果1: 通过本测试点|有效耗时62ms

测试结果2: 通过本测试点|有效耗时47ms

测试结果3: 通过本测试点|有效耗时47ms

测试结果4: 通过本测试点|有效耗时47ms

测试结果5: 通过本测试点|有效耗时47ms

测试结果6: 通过本测试点|有效耗时47ms

测试结果7: 通过本测试点|有效耗时47ms

测试结果8: 通过本测试点|有效耗时62ms

测试结果9: 通过本测试点|有效耗时63ms

测试结果10: 通过本测试点|有效耗时62ms

#1 .@2011-12-11 04:52:00
回复 删除
你的程序有很大的问题,看下面的

#include<stdio.h>

#include<stdlib.h>

struct f

{

int u;

int d;

int l;

int r;

};

struct f dt[10005];

int main()

{

int n,i,j,k,x1,y1,x,y,lx,ly,ans=-1;

scanf("%d",&n);

for(i=1;i<=n;i++)

{

scanf("%d%d%d%d",&x1,&y1,&lx,&ly);

dt[i].r=x1+lx;

dt[i].l=x1;

dt[i].u=y1+ly;

dt[i].d=y1;

}

scanf("%d%d",&x,&y);

for(i=n;i>0;i--)/*注意!*/

if((dt[i].l<=x && x<=dt[i].r) && (dt[i].d<=y && y<=dt[i].u))

{

ans=i;

break;/*注意!*/

}

printf("%d",ans);

system("pause");

return 0;

}

#2 吴钰晗@2011-12-12 04:26:00
回复 删除
我刚刚多交几次也过
#3 lxl-c++@2011-12-13 04:08:00
回复 删除
回复 沙发. 的帖子

问题是其他人像我这样也过了

O(n)算法,n才10000,应该不会超时

大牛请解释

查看更多回复
提交回复