Unofficial editorial-TWOGRS

Problem link : - TWOGRS Problem - CodeChef

Lets make it easy and clear ! :slight_smile:

Observation : - Answer is “NO” if (a+2*b+3*c) is odd. Agree?

If (a+2*b+3*c) is even:-

Answer is always “YES” , if a>=1 , b>=1 and c>=1

Proof:-
1)If a,b,c are even, answer is “YES”
2)If a,b,c are odd, answer is “YES”
3)If a=even and b,c=odd , this case is not allowed as the sum is odd :slight_smile:
4) If a=odd and b,c=even, this case is not allowed as the sum is odd :slight_smile:
5)If b=even and a,c=odd , answer is “YES” :slight_smile:
6) If b=odd and a,c=even,answer is “YES” :slight_smile:
5)If c=even and a,b=odd , this case is not allowed as the sum is odd :slight_smile:
6) If c=odd and a,b=even,this case is not allowed as the sum is odd :slight_smile:

Now, the only cases left are :- When one of the values (a,b,c) are zero or two of the values of (a,b,c) are zero.

I have discussed them here :- TWOGRS - Editorial - #15 by anon55659401

That exact post : -
This is the easiest I can explain guys -

1] If the sum (1*a+2*b+3*c==even) of all numbers is even, we check for something , else (Answer–>No).
(If sum is even, then only a set can be divided into 2-equal sets, agreed?)

2]If sum is even, and all a,b,c are positive. Answer is always Yes(you can try it yourself).

3)If sum is even and a=0 and c=0, just check the value of 'b'.

4)If sum is even, a=1 and c=odd number and b=0, answer is No.

5)If sum is even, b=1 and c=even number and a=0, answer is No.

6)For all others, answer is yes.

Link to my solution : -Very Short Code(CodeChef: Practical coding for everyone)

23 Likes

Katai zehar…awesome

2 Likes

where’s the link?
(though i don’t feel it’s necessary)
but yeah, nice :slight_smile:
very well done

1 Like

@jainaayush @chayanj450 u have to see this solution…

@moha08 Check this solution.

Hey ashutosh …can we please talk on FB.

Added the link :slight_smile: :slight_smile: :slight_smile:

1 Like

Sure @ssrivastava990

1 Like

Loved it ! :grin: Thanks for writing this

1 Like

This post was flagged by the community and is temporarily hidden.

How did you think of this ? I also saw some of the solutions in submissions and a lot of them were using just if/else statements like these…Am i the only dumb person ?

1 Like

Nope, you are not ! I personally found this problem harder than 1st question of Div-1 :slight_smile:

1 Like

forgot to add…Great solution btw

1 Like

@anon55659401 bahut hard bhai…nice explanation

1 Like

bilkul_hard :slight_smile: :slight_smile: :nerd_face: :sunglasses:

@anon55659401 bhai wo STRSUB avi tk nhi btaya :sweat_smile:

1 Like

Abhi toh kuch kaam kar rha hu, jald hi likh dunga bro.
(English Translation:-I am currently working on something, I’ll write its editorial soon :slight_smile: )

@anon55659401 ekdum bhai…
english me-okk bro…:joy:

1 Like

@anon55659401 bhaiya apka solution to samaj aa gya but editorial ka nhe aya.
kya editorial samajna jrore nhe (newbie coder)?

1 Like

As long as you understand the solution(any!), its all fine :slight_smile: