CF662A.Gambling Nim

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

As you know, the game of "Nim" is played with nn piles of stones, where the ii -th pile initially contains aia_{i} stones. Two players alternate the turns. During a turn a player picks any non-empty pile and removes any positive number of stones from it. The one who is not able to make a move loses the game.

Petya and Vasya are tired of playing Nim, so they invented their own version of the game and named it the "Gambling Nim". They have nn two-sided cards, one side of the ii -th card has number aia_{i} written on it, while the other side has number bib_{i} . At the beginning of the game the players put all the cards on the table, each card only one of its sides up, and this side is chosen independently and uniformly. Thus they obtain a sequence c1,c2,...,cnc_{1},c_{2},...,c_{n} , where cic_{i} is equal to aia_{i} or bib_{i} . Then they take nn piles of stones, with ii -th pile containing exactly cic_{i} stones and play Nim. Petya takes the first turn.

Given that both players play optimally, find the probability of Petya's victory. Output the answer as an irreducible fraction.

输入格式

The first line of the input contains a single integer nn ( 1<=n<=5000001<=n<=500000 ) — the number of cards in the deck.

Each of the following nn lines contains the description of one card, consisting of two integers aia_{i} and bib_{i} ( 0<=ai,bi<=10180<=a_{i},b_{i}<=10^{18} ).

输出格式

Output the answer as an irreducible fraction p/qp/q . If the probability of Petya's victory is 00 , print 0/1.

输入输出样例

  • 输入#1

    2
    1 1
    1 1
    

    输出#1

    0/1
    
  • 输入#2

    2
    1 2
    1 2
    

    输出#2

    1/2
    
  • 输入#3

    3
    0 4
    1 5
    2 3
    

    输出#3

    1/1
    
首页