Tag Archives: Rectangle

CodeChef : January Challenge 2018 – K-Concatenation

K-Concatenation Source: CodeChef You are given an array A with size N (indexed from 0) and an integer K. Let’s define another array B with size N · K as the array that’s formed by concatenating K copies of array A. For example, if A = {1, 2} and K = 3, then B = {1, 2, 1, 2, 1, 2}. You have to find the maximum subarray sum of the array B. Fomally, you should compute the maximum… Read More »

CodeChef : January Challenge 2018 – Maximum Score

Maximum Score Source: CodeChef You are given N integer sequences A1, A2, …, AN. Each of these sequences contains Nelements. You should pick N elements, each from one sequence; let’s denote the element picked from sequence Ai by Ei. For each i (2 ≤ i ≤ N), Ei should be strictly greater than Ei-1. Compute the maximum possible value of E1 + E2 + … + EN. If it’s impossible to pick the elements E1, E2, …, EN, print… Read More »

CodeChef : January Challenge 2018 – Rectangle

Rectangle Source: CodeChef You are given four integers a, b, c and d. Determine if there’s a rectangle such that the lengths of its sides are a, b, c and d (in any order). Input The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows. The first and only line of each test case contains four space-separated integers a, b, c and d. Output… Read More »