CF15C.Industrial Nim
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There are n stone quarries in Petrograd.
Each quarry owns m__i dumpers (1 ≤ i ≤ n). It is known that the first dumper of the i-th quarry has x__i stones in it, the second dumper has x__i + 1 stones in it, the third has x__i + 2, and the m__i-th dumper (the last for the i-th quarry) has x__i + m__i - 1 stones in it.
Two oligarchs play a well-known game Nim. Players take turns removing stones from dumpers. On each turn, a player can select any dumper and remove any non-zero amount of stones from it. The player who cannot take a stone loses.
Your task is to find out which oligarch will win, provided that both of them play optimally. The oligarchs asked you not to reveal their names. So, let's call the one who takes the first stone «tolik» and the other one «bolik».
彼得格勒有 n 个采石场。
第 i 个采石场(1≤i≤n)拥有 mi 辆自卸卡车。已知第 i 个采石场的第一辆自卸卡车装有 xi 块石头,第二辆装有 xi+1 块石头,第三辆装有 xi+2 块石头,……,第 mi 辆(即该采石场的最后一辆)装有 xi+mi−1 块石头。
两位寡头正在玩著名的 Nim 游戏。双方轮流从自卸卡车中取走石头。在每一轮中,玩家可任选一辆自卸卡车,并从中取走任意正整数块石头。无法取走石头的玩家判负。
你的任务是判断:在双方均采取最优策略的前提下,哪位寡头将获胜。这两位寡头要求你不要透露他们的姓名。因此,我们把先手取石头者称为「托里克」(tolik),后手者称为「博利克」(bolik)。
输入格式
The first line of the input contains one integer number n (1 ≤ n ≤ 105) — the amount of quarries. Then there follow n lines, each of them contains two space-separated integers x__i and m__i (1 ≤ x__i, m__i ≤ 1016) — the amount of stones in the first dumper of the i-th quarry and the number of dumpers at the i-th quarry.
输入的第一行包含一个整数 n(1 ≤ n ≤ 105)—— 矿场的数量。接下来有 n 行,每行包含两个以空格分隔的整数 xi 和 mi(1 ≤ xi, mi ≤ 1016)—— 分别表示第 i 个矿场的第一辆自卸卡车所装载的石块数量,以及第 i 个矿场拥有的自卸卡车数量。
输出格式
Output «tolik» if the oligarch who takes a stone first wins, and «bolik» otherwise.
如果先取石头的寡头获胜,则输出 «tolik»;否则输出 «bolik»。
输入输出样例
输入#1
2 2 1 3 2
输出#1
tolik
输入#2
4 1 1 1 1 1 1 1 1
输出#2
bolik
输入解题思路,AI测评打分。不知道怎么写?