CF699A  Launch of Collider
题目描述
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or more particles located in the same point. The coordinates of the particles coincide with the distance in meters from the center of the collider, xi is the coordinate of the ith particle and its position in the collider at the same time. All coordinates of particle positions are even integers.
You know the direction of each particle movement — it will move to the right or to the left after the collider’s launch start. All particles begin to move simultaneously at the time of the collider’s launch start. Each particle will move straight to the left or straight to the right with the constant speed of 1 meter per microsecond. The collider is big enough so particles can not leave it in the foreseeable time.
Write the program which finds the moment of the first collision of any two particles of the collider. In other words, find the number of microseconds before the first moment when any two particles are at the same point.
输入
The first line contains the positive integer n (1 ≤ n ≤ 200 000) — the number of particles.
The second line contains n symbols “L” and “R”. If the ith symbol equals “L”, then the ith particle will move to the left, otherwise the ith symbol equals “R” and the ith particle will move to the right.
The third line contains the sequence of pairwise distinct even integers x1, x2, …, x**n (0 ≤ x**i ≤ 109) — the coordinates of particles in the order from the left to the right. It is guaranteed that the coordinates of particles are given in the increasing order.
输出
In the first line print the only integer — the first moment (in microseconds) when two particles are at the same point and there will be an explosion.
Print the only integer 1, if the collision of particles doesn’t happen.
样例
Input
1  4 
Output
1  1 
Input
1  3 
Output
1  1 
注意
In the first sample case the first explosion will happen in 1 microsecond because the particles number 1 and 2 will simultaneously be at the same point with the coordinate 3.
In the second sample case there will be no explosion because there are no particles which will simultaneously be at the same point.
解题思路
AC代码
1 

English单词积累
collider—对撞机
particles—粒子
CF699B  One Bomb
题目描述
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (“.”) or it can be occupied by a wall (“*”).
You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y.
You are to determine if it is possible to wipe out all walls in the depot by placing and triggering exactly one bomb. The bomb can be laid both in an empty cell or in a cell occupied by a wall.
输入
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field.
The next n lines contain m symbols “.” and ““ each — the description of the field. jth symbol in ith of them stands for cell (i, j). If the symbol is equal to “.”, then the corresponding cell is empty, otherwise it equals ““ and the corresponding cell is occupied by a wall.
输出
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print “NO” in the first line (without quotes).
Otherwise print “YES” (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple answers, print any of them.
样例
Input
1  3 4 
Output
1  YES 
Input
1  3 3 
Output
1  NO 
Input
1  6 5 
Output
1  YES 
注意
无
解题思路
AC代码
1 

English单词积累
depot—仓库
rectangular—矩形