Hi! I am a beginner at cp. I was tring to solve this question https://www.codechef.com/problems/TWOGRS. I got every correct output( YES/NO ) to every input but still getting wrong answer. so my question is what is wrong in my solution ??
here is my solution
#include<bits/stdc++.h> using namespace std; #define ll long long int
int main() { ll t; cin>>t; while(t--)
{ ll a,b,c; cin>>a>>b>>c; ll total=0; total=(1*a)+(2*b)+(3*c); if(total%2==0) { ll num=total/2; ll div=0; div=num/3; num=num-(3* (min(div,c))); div=num/2; num=num-(2* (min(div,b))); div=num/1; num=num-(1* (min(div,a))); if(num==0) cout<<"YES"<<endl; else cout<<"NO"<<endl; } else cout<<"NO"<<endl; } return 0;
}
Asked by: anupam.433454 on March 21, 2020, 1:06 p.m. Last updated on March 21, 2020, 1:08 p.m.
https://www.codechef.com/viewsolution/30837601 Here is my submission. I have just considered 1 more case i.e checked if A,B and C aur are all even then we can simply distribute equally into 2 groups.
There are some cases for which your code is giving NO when count of all variables are even.
hritesh0027 last updated on March 28, 2020, 10:37 p.m.https://www.codechef.com/viewsolution/30837601
Here is my submission. I have just considered 1 more case i.e checked if A,B and C aur are all even then we can simply distribute equally into 2 groups.
There might be some large cases for which your code is giving NO when count of all variables are even.
You can also check my solution. It is different from yours: https://www.codechef.com/viewsolution/30843717