Why my code is not working for EID2

#include <bits/stdc++.h>
using namespace std;
main()
{
int age[3],mon[3];
int t;
cin>>t;
for(int i=0;i<t;i++)
{
for(int i=0;i<3;i++)
{
cin>>age[i];
}
for(int i=0;i<3;i++)
{
cin>>mon[i];
}
int f=1;
for(int i=0;i<2;i++)
{
if(i==0)
{
if(age[i]==age[i+2])
{
if(mon[i]!=mon[i+2])
{
f=0;
break;
}
}
}
if(age[i]==age[i+1])
{
if(mon[i]!=mon[i+1])
{
f=0;
break;
}
}
if(age[i]>age[i+1])
{
if(mon[i]<=mon[i+1])
{
f=0;
break;
}
}
if(age[i]<age[i+1])
{
if(mon[i]>=mon[i+1])
{
f=0;
break;
}
}
}
if(f==1)
cout<<“FAIR”;
else
cout<<“NOT FAIR”;
cout<<endl;
}
}

https://discuss.codechef.com/t/color-format-the-code/36585/2

1 Like

your concept is wrong…

“Fair” giving on this test case.
1
8 5 5 10 10 10

Hope you will debug it.

1 Like

where did I miss = sign

I tested this code

Please add the proper link or formatting should be proper otherwise no one will read it.
What I did, I went to your profile and picked up your last submission (improved approach may be what I thought).

You can see my submission https://www.codechef.com/viewsolution/26164952

can you now please check my latest submission ??
I have edited my code a little

you missed some cases I have improved your code :slight_smile:

https://www.codechef.com/viewsolution/26195513

Firstly learn how to properly format code in forum

2 Likes