codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

914B.md (1742B)


      1 Source: https://codeforces.com/problemset/problem/914/B
      2 
      3 B. Conan and Agasa play a Card Game
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has *n* cards, and the *i*-th card has a number *a**i* written on it.
     22 
     23 They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all cards having a number strictly lesser than the number on the chosen card. Formally, if the player chooses the *i*-th card, he removes that card and removes the *j*-th card for all *j* such that *a**j* < *a**i*.
     24 
     25 A player loses if he cannot make a move on his turn, that is, he loses if there are no cards left. Predict the outcome of the game, assuming both players play optimally.
     26 
     27 Input
     28 
     29 The first line contains an integer *n* (1 ≤ *n* ≤ 105) — the number of cards Conan has.
     30 
     31 The next line contains *n* integers *a*1, *a*2, ..., *a**n* (1 ≤ *a**i* ≤ 105), where *a**i* is the number on the *i*-th card.
     32 
     33 Output
     34 
     35 If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 3  
     43 4 5 7
     44 ```
     45 
     46 Output
     47 
     48 ```
     49 Conan
     50 ```
     51 
     52 Input
     53 
     54 ```
     55 2  
     56 1 1
     57 ```
     58 
     59 Output
     60 
     61 ```
     62 Agasa
     63 ```
     64 
     65 Note
     66 
     67 In the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.
     68 
     69 In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when it becomes Conan's turn again.