Given a map from arrays of integers of same size to single integers, determine if there is a set of indices such that the output is equal to the maximum of the elements at those indices for every corresponding pair.
You can take the input as a map if your language support, arrays of pairs, separated 2D array of input and its output, or other reasonable format. Shortest code wins.
Test cases
input => output
input => output -> truthy/falsey
[1,2,3] => 2
[2,1,3] => 2
[3,2,1] => 3 -> true (maximum of pos 1 and pos 2)
[1,2,3] => 2
[2,3,1] => 2
[3,3,2] => 2 -> false (Whatever positions chosen, 3 must at least appeared in output)
[1,2,3] => 2 -> true (maximum of pos 2, or maximum of pos 1 and 2)
[1,2,3] => 0 -> false (no way maximum of some of 1, 2 and 3 result in 0)
[[1,2,3],[2,1,3],[3,2,1]]
and[2,2,3]
? \$\endgroup\$