@manoj_269 There are too many test cases where your solution failed.
Here few of them:
0 5 2
4 1 6
6 5 6
6 7 8
8 3 8
4 9 4
6 1 2
@manoj_269 There are too many test cases where your solution failed.
Here few of them:
0 5 2
4 1 6
6 5 6
6 7 8
8 3 8
4 9 4
6 1 2
@rudransh_bt Check out the following test cases:
0 4 4
0 7 4
0 4 2
Your code maybe failed for a = 0 condition only, Here is a logic to solve it:
if ((a + c) % 2 == 0) {
if (a == 0 and b > 1)
cout << "YES"<< "\n";
else
cout << "NO"<< "\n";
}
//You must use your logic for two of a, b, c are 0 before checking a = 0
My logical solution here
@anon79977241 Check out the following test cases:
1 2 9
0 7 0
0 1 4
1 2 3
and so onâŚ
You should use capital letter, ex- YES
, NO
(According to problem statement).
You must use * between to variable/constant to get their product.
Check out the following test case:
0 7 2
0 5 6
Check out your solution for a = 0 case.
variable j is to ensure outer loop doesnât execute more than twice, and jj is to ensure that inner loop does not execute more than three times.
They serve no other purpose.
yes I copied incorrectly⌠the program outputs No for both the testcasesâŚ
Check out // try this way.
Testerâs solution seems to be very easy to understand but their is one thing which i am not getting i.e he has reduce A,B,C below 30 how come the answer is not affected by reducing them below 30
I donât think so.
For every test case answer should be yes.
Yeah @anon55659401 this solution will take expo time and indeed weak test cases . I read your Solution sir nice work .
#include
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(tâ)
{
int a,b,c,s;
cin>>a>>b>>c;
s=(1a+2b+3*c);
if(s%2==1)
cout<<âNOâ<<endl;
else
{
s=s/2;
if(b>=s/2)
{
if(s%2==0)cout<<âYESâ<<endl;
else
{
if(a>=1||c>=1)cout<<âYESâ<<endl;
else
cout<<âNOâ<<endl;
}
}
else
{
s=s-2*b;
if(c>=s/3)
{
if(s%3==0)cout<<"YES"<<endl;
else if(s%3==1 && a>=1)cout<<"YES"<<endl;
else if(s%3==2 && a>=2)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
else
{
s=s-3*c;
if(a>=s)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
}
}
return 0;
}
can anyone help me find my mistake??
Thanks man ,It really helped , finally accepted after so many attempts .
https://www.codechef.com/viewsolution/26793598
What about this now?(now works fine with the given test cases)
My pleasure
@tushar0609 Nope bro, You canât fix your solution for a = 0
case.
Check out the following test cases:
0 4 4
0 4 2
0 7 6
0 6 2
0 10 10
@manoj_269 Umm Answer should be YES but your solution provide NO
Explanation for last test case:
6 1 2
means => {1, 1, 1, 1, 1, 1, 2, 3, 3}
Group 1 = {1, 3, 3}
Group 2 = {1, 1, 1, 1, 1, 2}
Group 1 = Group 2 (= 7)
Therefore answer should be YES
Thanks man! for giving your time.
#respect