report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Sake game - FlandreOJ: Flandre Online Judge

Sake game

Time limit: 1000 ms
Memory limit: 256 MB
Marisa and Reimu are playing a game. There are $n$ sake cups and an array $A$ of $m$ integers. Starting from Marisa, they perform the following move alternately: - Choose an element $x$ from $A$ and drink $x$ cups. A player loses if she is unable to perform any move (in other words, $min(A) > y$ where $y$ is the number of sake cups left). Drinking a lot of alcohol is bad so they ask you to determine the winner if they both play optimally. ### Input - The first line contains 2 integers $n, m$. - The second line contains $m$ integers $A_i$. ### Output - Print `Marisa` if Marisa wins, otherwise print ```Reimu```. ### Constraints - $1 \le n \le 10^5$ - $1 \le m \le 100$. - $1 \le A_i \le 10^5$. ### Example Input: ``` 4 2 1 2 ``` Output: ``` Marisa ```
Introduction to Dynamic Programming (Part two)
Sake game
Coins
Coins 2
Game on array
Longest increasing subsequence 2
Convolution
Regular bracket sequence
Faulty addition
Weird bank
Delete operation
Palindromize
Color ribbon
Unique subsequences
Unique subsequences 2
Cow exhibition
Knapsack 3
Compressing array
Regular bracket sequence 2
Maximum path 3
Concating substring
Soil
Stacking boxes
String transformation
Palindromic quadruple
Finding teammates
Topic
Dynamic Programming
Rating 900
Solution (1) Solution