CHFQ-Editorial

PROBLEM LINK:

Practice

Contest

Author: Md Shahid

Tester: Md Shahid

Editorialist: Md Shahid

DIFFICULTY:

SIMPLE

#PREREQUISITES:

Array

PROBLEM:

Given the team points, you need to calculate minimum score difference between two teams.

EXPLANATION:

This is very simple problem. You just need to apply brute force approach to check every possible teams score difference. In this problem you need to calculate minimum point difference between two different team, this is very simple problem, you need to run two nested loop and check for each pair of teams and then print the minimum of it.

Algorithm :

   Input - N, M, W  
   Take an array Res[] 
   for i = 0 to i = N
           for j = i+1 to j = N
                   res = absolute(M[i] - M[j]) + absolute(W[i] - W[j])
                   Append res into Res
    Print minimum of Res 

#AUTHOR’S AND EDITORIALIST’S SOLUTIONS:

Author’s and editorialist’s solution can be found here.

why so much late for an editorial??? is this how codechef works?