Note: This is an approximate problem. There is no exact solution. You must find the most optimal solution. Please, take a look at the sample explanation to ensure that you understand the problem correctly.
Problem statement
You are given N strings. Each string is given in the form of an array cnt of size 26 where the ith element in array denotes the count of the ith character of lowercase English alphabets in the string.
You have to select exactly 4 distinct strings.
These strings will be inserted into a Trie in an optimal way (which might include shuffling of the characters), ensuring that the number of nodes in the Trie is minimized by the checker.
Your goal is to minimize the value of function Z,
Notes
Input format
Output format
Print 4 space separated integers (1-based), denoting the indices of the strings selected.
Constraints
N=3000≤cnt[i][j]≤105No string is empty
Verdit and Scoring
Approach