CF1369F.BareLee

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"...

The game is a one versus one game. It has tt rounds, each round has two integers sis_i and eie_i (which are determined and are known before the game begins, sis_i and eie_i may differ from round to round). The integer sis_i is written on the board at the beginning of the corresponding round.

The players will take turns. Each player will erase the number on the board (let's say it was aa) and will choose to write either 2⋅a2 \cdot a or a+1a + 1 instead. Whoever writes a number strictly greater than eie_i loses that round and the other one wins that round.

Now Lee wants to play "Critic" against Ice Bear, for each round he has chosen the round's sis_i and eie_i in advance. Lee will start the first round, the loser of each round will start the next round.

The winner of the last round is the winner of the game, and the loser of the last round is the loser of the game.

Determine if Lee can be the winner independent of Ice Bear's moves or not. Also, determine if Lee can be the loser independent of Ice Bear's moves or not.

Lee 习惯以一种帅气的方式收尾他的故事,但这次他险些失败,还好 Ice Bear 及时出现并帮了他。Lee 对此感激不尽,于是决定向 Ice Bear 展示他新开发的一款名为“Critic”的游戏……

该游戏为一对一博弈,共进行 tt 轮。每轮给定两个整数 sis_i 和 eie_i(这些数值在游戏开始前即已确定且双方均已知;不同轮次的 sis_i 和 eie_i 可能不同)。在第 ii 轮开始时,数字 sis_i 被写在黑板上。

两名玩家轮流行动。每次轮到某位玩家时,他需擦去黑板上的当前数字(记为 aa),然后选择写下 2⋅a2 \cdot a 或 a+1a + 1 中的一个数。任何一位玩家若写下严格大于 eie_i 的数,则该玩家输掉本轮,另一位玩家赢得本轮。

现在 Lee 想要与 Ice Bear 对战“Critic”游戏。对于每一轮,Lee 已预先选定其对应的 sis_i 和 eie_i。第一轮由 Lee 先手;每轮的负方将成为下一轮的先手。

最后一轮的胜者即为整局游戏的胜者,最后一轮的负方即为整局游戏的负方。

请判断:

  • Lee 是否无论 Ice Bear 如何应对,都能确保获胜?
  • Lee 是否无论 Ice Bear 如何应对,都会落败?

输入格式

The first line contains the integer tt (1≤t≤1051 \le t \le 10^5) — the number of rounds the game has.

Then tt lines follow, each contains two integers sis_i and eie_i (1≤si≤ei≤10181 \le s_i \le e_i \le 10^{18}) — the ii-th round's information.

The rounds are played in the same order as given in input, sis_i and eie_i for all rounds are known to everyone before the game starts.

第一行包含一个整数 tt(1≤t≤1051 \le t \le 10^5)—— 表示游戏的轮数。

接下来是 tt 行,每行包含两个整数 sis_i 和 eie_i(1≤si≤ei≤10181 \le s_i \le e_i \le 10^{18})—— 表示第 ii 轮的信息。

各轮游戏按输入中给出的顺序进行,且所有轮次的 sis_i 和 eie_i 在游戏开始前对所有参与者均已知。

输出格式

Print two integers.

The first one should be 1 if Lee can be the winner independent of Ice Bear's moves, and 0 otherwise.

The second one should be 1 if Lee can be the loser independent of Ice Bear's moves, and 0 otherwise.

输出两个整数。

第一个整数:若无论 Ice Bear 如何行动,Lee 都能获胜,则为 1;否则为 0。

第二个整数:若无论 Ice Bear 如何行动,Lee 都会失败,则为 1;否则为 0。

输入输出样例

  • 输入#1

    3
    5 8
    1 4
    3 10

    输出#1

    1 1
  • 输入#2

    4
    1 2
    2 3
    3 4
    4 5

    输出#2

    0 0
  • 输入#3

    1
    1 1

    输出#3

    0 1
  • 输入#4

    2
    1 9
    4 5

    输出#4

    0 0
  • 输入#5

    2
    1 2
    2 8

    输出#5

    1 0
  • 输入#6

    6
    216986951114298167 235031205335543871
    148302405431848579 455670351549314242
    506251128322958430 575521452907339082
    1 768614336404564650
    189336074809158272 622104412002885672
    588320087414024192 662540324268197150

    输出#6

    1 0

说明/提示

Remember, whoever writes an integer greater than eie_i loses.

注意,任何写下大于 eie_i 的整数的人都将输掉游戏。

输入解题思路,AI测评打分。不知道怎么写?

首页