← Back to topics
Topic

Task::boxes

Bedjovski
#include<iostream>
using namespace std;
int main()
{
int d1,s1,v1,d2,s2,v2;
cin>>d1>>s1>>v1>>d2>>s2>>v2;
if((d1>d2&&s1>s2&&v1>v2)||(d2>d1&&s2>s1&&v2>v1))
{
cout<<"DA"<<endl;
}
else if((d1>d2&&s1>v2&&v1>s2)||(d2>d1&&s2>v1&&v2>s1))
{
cout<<"DA"<<endl;
}
else if((d1>s2&&s1>d2&&v1>v2)||(d2>s1&&s2>d1&&v2>v1))
{
cout<<"DA"<<endl;
}
else if((d1>s2&&s1>v2&&v1>d2)||(d2>s1&&s2>v1&&v2>d1))
{
cout<<"DA"<<endl;
}
else if((d1>v2&&s1>d2&&v1>v2)||(d2>v1&&s2>d1&&v2>v1))
{
cout<<"DA"<<endl;
}
else if((d1>v2&&s1>v2&&v1>d2)||(d2>v1&&s2>v1&&v2>d1))
{
cout<<"DA"<<endl;
}
else
{
cout<<"NE"<<endl;
}
return 0;
}

passed 19/20..

failed @ test 18..
why? :S

task link: http://www.z-trening.com/tasks.php?show_task=5000000143
MilosRadic
do it more easily!sort and then check!
MilosRadic
well when u sort u just have to check whether the largest dimension of 1 box is larger than the largest dimension of the second box and so on...
Bedjovski
and what the hell is this code checking?
it just says that the result is wrong..
halil
Try:
4 8 3
6 6 6

and

1 5 1
3 2 5
Bedjovski
Y, it shows false on those.. But where is my mistake..?
halil
There is no such tests, so remove that part of program. Milos gave you good advice.The program will be much shorter, and therefore fewer chances of errors.
4 8 3
6 6 6
.....
3 4 8
6 6 6

and that is easy.
elvircrn
have you ever heard of sort function