Codeforces Round #439 (Div.2)
来源:互联网 发布:网络上形容男生的词 编辑:程序博客网 时间:2024/05/16 06:06
Rock... Paper!
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.
A positive integer n is decided first. Both Koyomi and Karen independently choose n distinct positive integers, denoted by x1, x2, ..., xnand y1, y2, ..., yn respectively. They reveal their sequences, and repeat until all of 2n integers become distinct, which is the only final state to be kept and considered.
Then they count the number of ordered pairs (i, j) (1 ≤ i, j ≤ n) such that the value xi xor yj equals to one of the 2n integers. Here xormeans the bitwise exclusive or operation on two integers, and is denoted by operators ^ and/or xor in most programming languages.
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.
The first line of input contains a positive integer n (1 ≤ n ≤ 2 000) — the length of both sequences.
The second line contains n space-separated integers x1, x2, ..., xn (1 ≤ xi ≤ 2·106) — the integers finally chosen by Koyomi.
The third line contains n space-separated integers y1, y2, ..., yn (1 ≤ yi ≤ 2·106) — the integers finally chosen by Karen.
Input guarantees that the given 2n integers are pairwise distinct, that is, no pair (i, j) (1 ≤ i, j ≤ n) exists such that one of the following holds: xi = yj; i ≠ j and xi = xj; i ≠ j and yi = yj.
Output one line — the name of the winner, that is, "Koyomi" or "Karen" (without quotes). Please be aware of the capitalization.
31 2 34 5 6
Karen
52 4 6 8 109 7 5 3 1
Karen
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.
In the second example, there are 16 such pairs, and Karen wins again.
题意:有2n个不同的整数均分为两份,x,y两数组中各一份,求有多少对 xi ^ yj 的值在这2n个数之中
题解:a^b = c a^c = b
所以肯定是成对存在的,胜出的只可能是Karen
#include<iostream>#include<stdio.h>#include<string.h>using namespace std;#define LL long longconst int maxn = 1e6+10;int main(){ int n; int x[maxn],y[maxn]; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&x[i]); for(int i=0;i<n;i++) scanf("%d",&y[i]); printf("Karen\n"); return 0;}
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div.2)
- Codeforces Round #439 (Div.2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2) C
- Codeforces Round #439 (Div. 2) 题解
- Codeforces Round #439 (Div. 2) 总结
- Codeforces Round #439 (Div. 2)A,B
- Codeforces Round #439 (Div. 2)E详解
- Codeforces Round #102 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #104 (Div. 2)
- Codeforces Round #105 (Div. 2)
- Codeforces Round #105 (Div. 2)
- vm虚拟机与主机之间设置共享文件夹/vm虚拟机不能显示全屏
- Common Git Alias For Copy
- HTML5带发光动画
- java socket基础-长连接与短连接
- PHP中数组的定义及声明实例
- Codeforces Round #439 (Div.2)
- Gym-101201B(bfs+dp)
- HttpClientUtil
- 垃圾收集器
- 查询某个表被哪些存储过程(以下简称 SP)使用到、查找那些过程对该表做了更新操作:
- CoreJava学习笔记-Java核心编程-学习笔记
- 文章标题
- Java EE开发第十三章:jsp基础、cookie、session
- Android Sqlite 增删改查