Page 1 of 2
Posted: Wed Jan 16, 2002 10:23 am
by Andrey Popyk
Wy i received Wrong Answer?
It is very simple problem...
#include <iostream.h>
int min(int a,int b)
{ if (a<b) return a; else return b;}
int max(int a,int b)
{ if (a>b) return a; else return b;}
int main()
{
int l1,r1,u1,d1,l2,r2,u2,d2;
cin>>l1>>d1>>r1>>u1;
cin>>l2>>d2>>r2>>u2;
l1=max(l1,l2); r1=min(r1,r2);
u1=min(u1,u2); d2=max(d1,d2);
if (l1>=r1 || d1>=u1) cout<<"No Overlap"<<endl;
else cout<<l1<<' '<<d1<<' '<<r1<<' '<<u1<<endl;
return 0;
}
Posted: Wed Jan 16, 2002 11:32 am
by Adrian Kuegel
I think you have to use d2 instead of d1, that means
if (l1>=r1 || max(d1,d2)>=u1) cout<<"No Overlap"<<endl;
else cout<<l1<<' '<<max(d1,d2)<<' '<<r1<<' '<<u1<<endl;
Posted: Wed Jan 16, 2002 1:48 pm
by Andrey Popyk
Thanks, I correct this stupid bug, but I received WA again.
I am confused, can anyone help me?
#include <iostream.h>
int min(int a,int b)
{ if (a<b) return a; else return b;}
int max(int a,int b)
{ if (a>b) return a; else return b;}
int main()
{
int l1,r1,u1,d1,l2,r2,u2,d2;
cin>>l1>>d1>>r1>>u1;
cin>>l2>>d2>>r2>>u2;
l1=max(l1,l2); r1=min(r1,r2);
u1=min(u1,u2); d1=max(d1,d2);
if (l1>=r1 || d1>=u1) cout<<"No Overlap"<<endl;
else cout<<l1<<' '<<d1<<' '<<r1<<' '<<u1<<endl;
return 0;
}
Posted: Wed Jan 16, 2002 6:37 pm
by Adrian Kuegel
You must print a blank line between the test cases (multiple input).
Posted: Thu Jan 17, 2002 11:36 am
by Andrey Popyk
Thanks, I got Accepted.
[460] Is This Multiple Input??? -_-;;;
Posted: Mon Aug 05, 2002 8:49 pm
by Chung Ha, Yun
Why WA??
This problem is Multiple Input?
I don't know my mistake....
[cpp]
#include <iostream>
using namespace std;
int min(int a,int b);
int max(int a,int b);
int main()
{
int XLL1,YLL1,XUR1,YUR1,XLL2,YLL2,XUR2,YUR2;
cin>>XLL1>>YLL1>>XUR1>>YUR1;
cin>>XLL2>>YLL2>>XUR2>>YUR2;
XLL1=max(XLL1,XLL2);
XUR1=min(XUR1,XUR2);
YUR1=min(YUR1,YUR2);
YLL1=max(YLL1,YLL2);
if((XLL1 >= XUR1) || (YLL1 >= YUR1))
cout<<"No Overlap"<<endl;
else
cout<<XLL1<<' '<<YLL1<<' '<<XUR1<<' '<<YUR1<<endl;
return 0;
}
int min(int a,int b)
{
return a < b ? a : b;
}
int max(int a,int b)
{
return a > b ? a : b;
} [/cpp]
minput!
Posted: Sun Aug 11, 2002 5:52 am
by liusu
yes,it's minput!so there is some prblrm with your input.you can see the page below:
http://acm.uva.es/problemset/minput.html
460 WA
Posted: Mon Mar 24, 2003 11:54 pm
by afonsocsc
Keeps getting wa, don't know why...
Is there some trick?
[c]
...
[/c]
Posted: Tue Mar 25, 2003 12:10 am
by turuthok
Looks like this problem has a "multiple-input" format ... I don't think your solution handles this.
-turuthok-
Posted: Tue Mar 25, 2003 12:29 am
by afonsocsc
Fixed it, thanks!
They should say it in the problem...

460 - Overlapping Rectangles
Posted: Sun Nov 28, 2004 9:33 am
by leonardooo
What's wrong with my code? I got WA many times!!! Somebody has input test cases?
[java]
//Problem 460
//Code removed because author got AC !!!
[/java]
thx
Posted: Sun Nov 28, 2004 11:47 am
by shamim
consider the input:
0 0 10 10
10 5 30 30
The output should be No Overlap.
Posted: Sun Nov 28, 2004 9:40 pm
by leonardooo
but problem text says: "Note that two windows that share a common edge but have no other points in common are considered to have ``No Overlap"."
in your test case, there are more than one common points: 10,5 10,6 10,7 10,8 10,9 10,10
my program output 10 5 10 10

Posted: Mon Nov 29, 2004 7:24 am
by sohel
leonardooo wrote:
but problem text says: "Note that two windows that share a common edge but have no other points in common are considered to have ``No Overlap"."
in your test case, there are more than one common points: 10,5 10,6 10,7 10,8 10,9 10,10
my program output 10 5 10 10
It's is true that there are more than one common points, but all the points are part of the same edge, isn't it. And there is no other point that is common and does not lie on this edge.
Therefore the answer should be 'No Overlap'.
and consider your output( 10 5 10 10 ) -- it is a line, not a rectangle.
Posted: Mon Nov 29, 2004 7:45 am
by leonardooo