ThePermutationGameDiv2
SRM 652 · 2015-01-29 · by lg5293
Problem Statement
Alice and Bob are playing a game called "The Permutation Game".
The game is parameterized with the
Notes
- The return value will fit into a signed 64-bit integer.
- A permutation of the first N positive integers is a sequence of length N that contains each of the integers 1 through N exactly once. The i-th (1-indexed) element of a permutation p is denoted by p[i].
Constraints
- N will be between 1 and 35 inclusive.
2 Returns: 2
Bob can choose the permutations {1,2} or {2,1}. If Alice chooses 1, then, Bob can choose the permutation {2,1}, which would would make f(1) = 2. However, if Alice chooses 2, no matter which permutation Bob chooses, Alice will get f(2) = 1. Thus the answer in this case is 2.
3 Returns: 6
6 Returns: 60
11 Returns: 27720
25 Returns: 26771144400
Submissions are judged against all 36 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class ThePermutationGameDiv2 with a public method long long findMin(int N) · 36 test cases · 2 s / 256 MB per case