CF1733E.Conveyor
省选/NOI-
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There is a conveyor with 120 rows and 120 columns. Each row and column is numbered from 0 to 119, and the cell in i-th row and j-th column is denoted as (i,j). The top leftmost cell is (0,0). Each cell has a belt, and all belts are initially facing to the right.
Initially, a slime ball is on the belt of (0,0), and other belts are empty. Every second, the state of the conveyor changes as follows:
- All slime balls on the conveyor move one cell in the direction of the belt at the same time. If there is no cell in the moved position, the slime gets out of the conveyor, and if two slime balls move to the same cell, they merge into one.
- All belts with slime ball in the previous second change direction at the same time: belts facing to the right become facing to the down, and vice versa.
- A new slime ball is placed on cell (0,0).
There are q queries, each being three integers t, x, and y. You have to find out if there is a slime at the cell (x,y) after t seconds from the start. Can you do it?
有一个 120 行 120 列的传送带。每行和每列均编号为 0 至 119,第 i 行第 j 列的格子记作 (i,j),左上角的格子为 (0,0)。每个格子中有一个传送带,所有传送带初始方向均朝右。
初始时,一个史莱姆球位于 (0,0) 格子的传送带上,其余格子为空。每一秒,传送带的状态按如下规则变化:
- 传送带上所有史莱姆球同时沿其所在格子传送带的方向移动一格。若移动后的位置超出传送带边界,则该史莱姆球离开传送带;若两个史莱姆球移动至同一格子,则它们合并为一个。
- 所有在上一秒中有史莱姆球经过的格子上的传送带同时改变方向:原本朝右的变为朝下,原本朝下的变为朝右。
- 在格子 (0,0) 上放置一个新的史莱姆球。
共有 q 个查询,每个查询包含三个整数 t、x 和 y。你需要判断:从起始时刻开始经过 t 秒后,格子 (x,y) 上是否存在史莱姆球。你能做到吗?
输入格式
The first line contains one integer q (1≤q≤104) — the number of queries.
The only line of each query contains three integers t, x, and y (0≤t≤1018, 0≤x,y<120).
第一行包含一个整数 q(1≤q≤104)—— 表示查询次数。
每个查询仅有一行,包含三个整数 t、x 和 y(0≤t≤1018,0≤x,y<120)。
输出格式
Print the answer for each test case, one per line. If there is a slime ball in the cell (x,y) after t seconds from the initial state, print "YES". Otherwise, print "NO".
对每个测试用例,输出一行答案。如果从初始状态起经过 t 秒后,单元格 (x,y) 中存在一个史莱姆球,则输出 "YES";否则输出 "NO"。
输入输出样例
输入#1
6 1 1 0 5 1 3 0 0 0 2 4 5 2 0 2 1547748756 100 111
输出#1
NO YES YES NO YES YES
说明/提示
The state of conveyor with t=0. Red arrow represents the direction of each belt, and blue figure represents slime.

The state of conveyor with t=1.

The state of conveyor with t=2.

时间 t=0 时的传送带状态。红色箭头表示每条传送带的运动方向,蓝色图形表示史莱姆。

时间 t=1 时的传送带状态。

时间 t=2 时的传送带状态。

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