codeforces-scrape

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

869A.md (2516B)


      1 Source: https://codeforces.com/problemset/problem/869/A
      2 
      3 A. The Artful Expedient
      4 
      5 time limit per test
      6 
      7 1 second
      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 Rock... Paper!
     22 
     23 After Karen have found the deterministic winning (losing?) strategy for rock-paper-scissors, her brother, Koyomi, comes up with a new game as a substitute. The game works as follows.
     24 
     25 A positive integer *n* is decided first. Both Koyomi and Karen independently choose *n* distinct positive integers, denoted by *x*1, *x*2, ..., *x**n* and *y*1, *y*2, ..., *y**n* respectively. They reveal their sequences, and repeat until all of 2*n* integers become distinct, which is the only final state to be kept and considered.
     26 
     27 Then they count the number of ordered pairs (*i*, *j*) (1 ≤ *i*, *j* ≤ *n*) such that the value *x**i* xor *y**j* equals to one of the 2*n* integers. Here xor means the [bitwise exclusive or](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) operation on two integers, and is denoted by operators ^ and/or xor in most programming languages.
     28 
     29 Karen claims a win if the number of such pairs is even, and Koyomi does otherwise. And you're here to help determine the winner of their latest game.
     30 
     31 Input
     32 
     33 The first line of input contains a positive integer *n* (1 ≤ *n* ≤ 2 000) — the length of both sequences.
     34 
     35 The second line contains *n* space-separated integers *x*1, *x*2, ..., *x**n* (1 ≤ *x**i* ≤ 2·106) — the integers finally chosen by Koyomi.
     36 
     37 The third line contains *n* space-separated integers *y*1, *y*2, ..., *y**n* (1 ≤ *y**i* ≤ 2·106) — the integers finally chosen by Karen.
     38 
     39 Input guarantees that the given 2*n* integers are pairwise distinct, that is, no pair (*i*, *j*) (1 ≤ *i*, *j* ≤ *n*) exists such that one of the following holds: *x**i* = *y**j*; *i* ≠ *j* and *x**i* = *x**j*; *i* ≠ *j* and *y**i* = *y**j*.
     40 
     41 Output
     42 
     43 Output one line — the name of the winner, that is, "Koyomi" or "Karen" (without quotes). Please be aware of the capitalization.
     44 
     45 Examples
     46 
     47 Input
     48 
     49 ```
     50 3  
     51 1 2 3  
     52 4 5 6
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 Karen
     59 ```
     60 
     61 Input
     62 
     63 ```
     64 5  
     65 2 4 6 8 10  
     66 9 7 5 3 1
     67 ```
     68 
     69 Output
     70 
     71 ```
     72 Karen
     73 ```
     74 
     75 Note
     76 
     77 In the first example, there are 6 pairs satisfying the constraint: (1, 1), (1, 2), (2, 1), (2, 3), (3, 2) and (3, 3). Thus, Karen wins since 6 is an even number.
     78 
     79 In the second example, there are 16 such pairs, and Karen wins again.