Please note: VROOK cannot go back-ward - that leads to a simple variation to Game of Nim: just XOR.

t = int(input())
for _ in range(t):
n = int(input())
# Get input
p1 = []
for _ in range(n): p1.append(int(input()))
p2 = []
for _ in range(n): p2.append(int(input()))
# Game of Nim
nim = 0
for i in range(n):
nim ^= abs(p2[i]- p1[i]) - 1
print ("player-2" if nim != 0 else "player-1")

HackerRank "Vertical Rooks"的更多相关文章

  1. VK Cup 2015 - Round 1 E. Rooks and Rectangles 线段树 定点修改,区间最小值

    E. Rooks and Rectangles Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/problemse ...

  2. Vertical Menu ver4

    以前一直使div来创建Vertical菜单,也曾有过3个版本.http://www.cnblogs.com/insus/archive/2011/10/19/2217314.html 现今Insus. ...

  3. [LeetCode] Binary Tree Vertical Order Traversal 二叉树的竖直遍历

    Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bott ...

  4. UVA - 11134 Fabled Rooks[贪心 问题分解]

    UVA - 11134 Fabled Rooks We would like to place n rooks, 1 ≤ n ≤ 5000, on a n × n board subject to t ...

  5. LeetCode Binary Tree Vertical Order Traversal

    原题链接在这里:https://leetcode.com/problems/binary-tree-vertical-order-traversal/ 题目: Given a binary tree, ...

  6. 日常小测:颜色 && Hackerrank Unique_colors

    题目传送门:https://www.hackerrank.com/challenges/unique-colors 感谢hzq大神找来的这道题. 考虑点分治(毕竟是路经统计),对于每一个颜色,它的贡献 ...

  7. Binary Tree Vertical Order Traversal

    Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bott ...

  8. HackerRank "Square Subsequences" !!!

    Firt thought: an variation to LCS problem - but this one has many tricky detail. I learnt the soluti ...

  9. HackerRank "Minimum Penalty Path"

    It is about how to choose btw. BFS and DFS. My init thought was to DFS - TLE\MLE. And its editorial ...

随机推荐

  1. 我看的公开课系列--《TED:对无知的追求》 by stuart firestein

    http://open.sina.com.cn/course/id_1047/ What scientists do is not just collect data and collect fact ...

  2. java NIO-我们到底能走多远系列(39)

    献给各位: Satisfied MindRed Hayes and Jack RhodesHow many times have you heard someone say,"If I ha ...

  3. 触摸精灵lua脚本实现微信群加好友功能

    --此脚本针对iPhone5/5s --目前只实现一个屏幕微信群好友的添加,如果想添加更多好友, --需要划屏操作,执行划屏操作时建议循环滑动 function main() --获取屏幕的分辨率 w ...

  4. 229. Majority Element II

    Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorit ...

  5. Educational Codeforces Round 15 A dp

    A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input standard ...

  6. 用过sessionid防钓鱼

    http://www.cnblogs.com/BearsTaR/archive/2010/08/24/URL_SESSION_ID_LEEK.html DisableUrlSessionFilter

  7. c++变量的引用---5

    原创博客:转载请标明出处:http://www.cnblogs.com/zxouxuewei/ 1.引用变量的主要用途: 用作函数的形参,通过将引用变量用作参数,函数将使用原始数据而不是其拷贝. 2. ...

  8. (转载)Hadoop map reduce 过程获取环境变量

    来源:http://www.linuxidc.com/Linux/2012-07/66337.htm   作者: lmc_wy Hadoop任务执行过程中,在每一个map节点或者reduce节点能获取 ...

  9. leetcode 107 Binary Tree Level Order Traversal II ----- java

    Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left ...

  10. JavaScript学习记录总结(十)——几个重要的BOM对象

    一.弹出框 <script type="text/javascript">    window.onload=function(){         window.al ...