Problem 2291. GJam 2014 Qualifier: Deceitful War (Small)

This Challenge is derived from GJam 2014 Qualifier Deceitful War.

My condensed summary of the problem statement.

Given two players, A and B, they are each given N masses. All masses are unique. Player A plays first on each comparison and states a Mass. Player B then plays a Mass. The player with the higher mass wins a point after they are compared on a scale. These masses then disappear. This repeats for all N masses. There are no constraints on the order of pieces played.

Unsurprisingly when A truthfully states masses player B consistently wins.

Player A, discouraged, decides to cheat. After the masses are provided player A asks B get A a drink and while B is away A looks at B's masses. Player A now plays pieces but does not necessarily honestly state the mass values. All scale comparisons must be valid based on B's strategy and A's stated mass. Player A now achieves more wins.

Part one is determine the best possible score for A when playing deceitfully.

Part two is determine the best possible score if player A did not look and is honest.

Examples:

A: 0.5 0.1 0.9  B 0.6 0.4 0.3  Deceitful Wins 2, Optimal Honest 1
A 0.186 0.389 0.907 0.832 0.959 0.557 0.300 0.992 0.899
B 0.916 0.728 0.271 0.520 0.700 0.521 0.215 0.341 0.458
Deceitful A Wins 8
Optimal Honest A Wins 4

Input: A,B vectors of length N (Small has N<=10, Large(future challenge N<=1000)

Output: Deceitful Wins, Optimal Honest Wins

Note:

In the contest period there were 30 Matlab solutions, of which I was not one as I glitched on the easy Deceitful algorithm thinking my Honest algorithm was in error. GJam Deceitful Solutions. My post contest full GJam is in the test suite. About 11000 out of 28000 entrants solved this puzzle.

Solution Stats

55.0% Correct | 45.0% Incorrect
Last Solution submitted on Jul 08, 2021

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers8

Suggested Problems

More from this Author308

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!