CommonLounge Archive

[CROFT] The Crofts Game

May 07, 2019

Link to problem: https://www.codechef.com/problems/CROFT

Problem in short:

There are two integer arrays A and B with n elements each.

We’re playing a 2-player game. During each turn, the current player must choose an integer i, (such that 0 <= i <= n – 1). If the current player is Player 1, then he receives A[i] points; if the current player is Player 2, then he receives B[i] points. The game always ends after n moves. Each value of ‘i’ can be chosen only once. The player with the maximum number of points wins.

Given the values of n, A, and B, determine the outcome of the game.


© 2016-2022. All rights reserved.