Piles with stones

Codeforces Round #500 (Div. 2)

CONTENT

1. Understanding the problem statement.

2. Understanding the concept.

3. Taking various examples of the problem.

4. Live coding in c++.

5. Optimising the code.

         1         2         3         4         5
         2        1         4          3         5

Sample inputs :

5
1 2 3 4 5
2 1 4 3 5

 

array 1:

 

sum(array 1) = 1 + 2+ 3 + 4 + 5 = 15

 

array 2:

 

sum(array 2) = 2 + 1 + 4 + 3 + 5 = 15

Sample inputs:

5

1 1 1 1 1

1 0 1 0 1

 

array 1:

 

     

      sum = 1+ 1 + 1+ 1+1 = 5

 

array 2:

 

 

      sum = 1+0+ 1+ 0 + 1 = 3

 

         1          1          1          1          1
        1          0         1         0          1

Sample inputs:

5

1 2 4 0 1

1 3 4 2 2

 

array 1:

 

     

      sum = 1+ 2 + 4+ 0+1 = 8

 

array 2:

 

 

      sum = 1 + 3 + 4 + 2 + 2 = 12

 

         1          2          4          0          1
        1          3         4         2          2

PSEUDO CODE :

t    <---   input 

//here we will enter the length of string

A   <---     input  // here we will enter the initial list of EJOI group

B   <---     input  // here we will enter the initial list of EJOI group .

/*Note as given in test case take input by giving space between two consecutive numbers*/

sum 1 = sum of A

sum 2 = sum of B

if (sum 2 <= sum 1)

     print yes

else

       print no

 

 

 

deck

By Chirayu Jain