A7759 | Industrial Nim
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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».
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».
输入格式
The first line of the input contains one integer number $n$ ( $1<=n<=10^{5}$ ) — 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}<=10^{16}$ ) — the amount of stones in the first dumper of the $i$ -th quarry and the number of dumpers at the $i$ -th quarry.
输出格式
Output «tolik» if the oligarch who takes a stone first wins, and «bolik» otherwise.
输入输出样例
输入 #1
2 2 1 3 2
输出 #1
tolik
输入 #2
4 1 1 1 1 1 1 1 1
输出 #2
bolik
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted