Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

你很气愤,后果严重不?

Posted by qianguize at 2008-05-01 22:34:37 on Problem 2736
In Reply To:管理员请进,数据错误,我很气愤! Posted by:sunnyboy1001 at 2008-05-01 22:33:09
> 题目说:No two rooms will overlap, though they may share a side.
> 但是,数据中有两个房间重复的。
> 以下是我的ac程序,如果把注释部分还原,就会得到ole。以此证明数据有误,也可以看我最近两次提交程序。欢迎讨论,谢谢~~
> #include<stdio.h>
> __int64 f(__int64 w,__int64 x,__int64 y,__int64 z);
> int main(void)
> {
>    __int64 num,i,a[1010][6]={0},ans,l,w,j,zu=1,d;
>    while(1){
>       ans=0;
>       scanf("%I64d",&num);
>       if(num==0)
>          break;
>       for(i=0;i<num;i++){
>          scanf("%I64d%I64d%I64d%I64d",&a[i][0],&a[i][1],&a[i][2],&a[i][3]);
>          if(a[i][0]>a[i][2]){
>             j=a[i][0];
>             a[i][0]=a[i][2];
>             a[i][2]=j;
>          }   
>          if(a[i][1]>a[i][3]){
>             j=a[i][1];
>             a[i][1]=a[i][3];
>             a[i][3]=j;
>          }   
>          a[i][4]=a[i][2]-a[i][0];
>          a[i][5]=a[i][3]-a[i][1];
>          for(l=a[i][4],w=a[i][5];l>0&&w>0;l--,w--)
>             ans+=l*w;
>       }   
>       for(i=0;i<num-1;i++)
>          for(j=i+1;j<num;j++){
>             if(/*a[i][0]==a[j][0]||*/a[i][0]==a[j][2]||a[i][2]==a[j][0]/*||a[i][2]==a[j][2]*/){
>                d=f(a[i][1],a[i][3],a[j][1],a[j][3])-2;
>                for(w=d-1,l=2;l<=a[i][4]+a[j][4]&&w>0;w--,l++){
>                   while(a[i][0]==a[j][0]||a[i][2]==a[j][2])
>                      printf("fuck poj!");
>                   if(l<=a[i][4]+1&&l<=a[j][4]+1)
>                      ans+=w*(l-1);
>                   else if(l>a[i][4]+1&&l>a[j][4]+1)
>                      ans+=w*(a[i][4]+a[j][4]-l+1);
>                   else{
>                      if(l>a[i][4]+1){
>                         ans+=w*a[i][4];
>                      }   
>                      else{
>                         ans+=w*a[j][4];
>                      }   
>                   }   
>                }   
>             }   
>             if(/*a[i][1]==a[j][1]||*/a[i][1]==a[j][3]||a[i][3]==a[j][1]/*||a[i][3]==a[j][3]*/){
>                d=f(a[i][0],a[i][2],a[j][0],a[j][2])-2;
>                for(w=d-1,l=2;l<=a[i][5]+a[j][5]&&w>0;w--,l++){
>                   while(a[i][1]==a[j][1]||a[i][3]==a[j][3])
>                      printf("fuck poj!");
>                   if(l<=a[i][5]+1&&l<=a[j][5]+1)
>                      ans+=w*(l-1);
>                   else if(l>a[i][5]+1&&l>a[j][5]+1)
>                      ans+=w*(a[i][5]+a[j][5]-l+1);
>                   else{
>                      if(l>a[i][5]+1){
>                         ans+=w*a[i][5];
>                      }   
>                      else{
>                         ans+=w*a[j][5];
>                      }   
>                   }   
>                }   
>             }   
>          }
>       printf("Case %I64d: %I64d\n",zu++,ans);
>    }   
>    system("pause");
>    return 0;
> }    
> __int64 f(__int64 w,__int64 x,__int64 y,__int64 z)
> {
>    __int64 hold;
>    if(z>x)
>       hold=x;
>    else
>       hold=z;
>    if(y>w)
>       hold-=y;
>    else
>       hold-=w;
>    return hold;
> }   

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator