GreaterGameDiv2
SRM 637 · 2014-08-25 · by snuke
Problem Statement
Cat Snuke and wolf Sothe are playing the Greater Game. The game is played with cards. Each card has a number written on it. There are 2N cards. The numbers on the cards are the integers between 1 and 2N, inclusive.
At the beginning of the game, each player gets N of the cards and chooses the order in which he wants to play them. The game then consists of N turns. In each turn, both players play one of their cards simultaneously. The player who revealed the card with the larger number gets a point.
You are given two
Constraints
- N will be between 1 and 50, inclusive.
- snuke and sothe will contain exactly N elements each.
- Each integer in snuke and sothe will be between 1 and 2N, inclusive.
- The integers in snuke and sothe will be distinct.
{1,3}
{4,2}
Returns: 1
Snuke loses the first round because 1 is less than 4. Snuke then wins the second round because 3 is greater than 2.
{1,3,5,7,9}
{2,4,6,8,10}
Returns: 0
{2}
{1}
Returns: 1
{1}
{2}
Returns: 0
{1,2,3,4,5}
{6,7,8,9,10}
Returns: 0
Submissions are judged against all 68 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class GreaterGameDiv2 with a public method int calc(vector<int> snuke, vector<int> sothe) · 68 test cases · 2 s / 256 MB per case