Hello CodeForces Community!

I would like to invite you all to participate on Tishreen-CPC 2018 contest on GYM. The contest was originally held in Syria, Lattakia for Tishreen University.

**Problem Setters and Testers**

SAeed (Saeed Sryhini)

Mhammad1 (Mohammad Shahhoud)

Ahmad1 (Ahmad Gafer)

JoudZouzou (Joud Zouzou)

Daniar (Daniar Jarrous)

I-Love-Islam (Rami Al-Saddaka)

Mohammad_Karttomeh (Mohammad Karttomeh)

m.ajaj94 (Majd Ajaj)

I hope you will enjoy solving the problems we prepared. Please give your feedback on the problem set in the comments below, after the contest. The contest difficulty should be similar to a Div2 Codeforces round, However I would recommend participating as a team because it is a standard ACM-ICPC contest.

Contest Details:

**Time:** 19th May 2018 (12:00 hrs) (GMT+3). You can check your local time here.

**Contest Length:** 5 hours.

**Number of Problems:** 12 problems.

Good Luck! Hope to see you participating!!

It is bad that it is right before codejam round 2 (17:00 MSK)

I guess I am gonna try those problems tomorrow.

Sorry, didn't realize that. Anyways good luck tomorrow ;)

How to solve E and H?

We will publish a tutorial soon.

The problems were very good. Thanks for a great contest ^_^

Glad you enjoyed them. Try the ones you didn't solve. We will try to publish a tutorial soon.

What does

Ballon Colormean in the statements?Since it is a standard ACM-ICPC contest, problem statements contained ballon colors. In this GYM contest they don't mean anything, but we published problem statementa the same as they were in the original contest.

very nice problems! I'm glad to win contest and beat road to grandmaster team :)

Glad you enjoyed them. The remaining 2 problems are a good practice to solve ;)

yes, I will try to solve remaining problems tomorrow. they are interesting problem too!

Thank you! I want to ask you if my proof is true or not ! Problem I. Odd and Even Queries if number is odd then odd * odd never give me the even number and odd * odd =odd, if number is even then even * odd will give me the even number and even*even=even, assume that we have the array of 1 2 3 4 5 6 7 8 9 10, the odd array is index for numbers 1 3 5 7 9 and the even array is index for numbers 2 4 6 8 10 if x =1 and the l=1 and r=5 then we have 1 3 5 , to calculate the multiplication for them as 1*3 and 1*5 3*5 1 3 5 so the answer is 6%(1e9+7) we can calculate them as the number of odd numbers from l to r as ((the number of odd number*(the number of odd number+1))/2 but for the even number we have to add to the answer the number of even numbers * the number of odd numbers from l to r Am I wrong ? sorry for my bad English!

The problem asks for sub-sequences not only pairs (Try solving it for subsequences before checking the spoiler).

SpoilerWhen the required number is odd, any subsequence of odd numbers is valid (except the empty one), so the answer is 2

^{odd}- 1, whereoddis the number of odd numbers in the required range.When the required number is even, all subsequences are valid except the subsequences that consist of odd numbers only, so the answer is 2

^{r - l + 1}- 2^{odd}.Thank you joud. Thank you for your help. I didn't know Spoiler,but you explained it to me .thank you !

Never mind this comment.

can you give me an example to avoid this mistake in the future ? I calculated a lot of numbers but never gives me an even number .

Ah sorry I thought you meant something else. Never mind

Hahahaha it's okay :)

tutorial ??

Bump! When will the tutorial be published?

how you solved H;

I am pretty bad at explaining things, but nevertheless I will give it a try.

Root the tree at A for ease. Observe that if we choose any vertex from subtree of B as D, and any vertex from subtree of A(but not subtree of B including B) as C, the path between A -> C and B -> D will never intersect.

Now, you can even select any vertex which is parent of B(but not A) as D. In this case, the vertex that are candidates of C are all the vertices in subtree of A — vertices in subtree of chosen vertex D.

This can be calculated by running a DFS with root as A and storing subtree size. Here's my code for reference. I hope its readable.

thanks

Also, can you please share your approach for E?

https://ideone.com/zo9Yzp

Xor All Element have to be (0)

so just count times you can distribute (n)

Thanks :)

Learn about Nim Games

Is there a tutorial series on these problems? I solved about two only. And need help solving one or two more. XD

How to solve problem J please is it Mo's +trie?