QbztDay1 Travels

qbzt burst zero record Day1

T1





Why do not we put this robot directly scrapped it?

Quality title

In fact, this is aYou membranesimulation

Pit:

If you went to the pool and fell in, grid position is not in front of the pool, but the location of this instruction before execution

Some advice from teachers

Can be divided into several independent function to write, for example, the robot movement and rotation of the robot or the like written with

T2

Lost thorn dolphin (expand, 1.5s, 64M)
Title Description
barbed dolphin named a small T, the mother early in the morning just let it go out to buy food.
It saw a cute little hippocampus, chasing all the way it ran and ran.
The results ...... small T lost. But his mother'm worried at home, it is to hurry home after buying food.
and so! Top priority! It is to know that the road to buy food ......
it remembers coordinate all food stores, but also know it now coordinates. Please help her find a way of buying food bar.
It has already anxious gonna cry, it wants to go home after buying food. So it requires you to find the shortest way to buy food.
Because it is a possible expansion of thorn dolphin, it is much like his physique, so it wants to make his physique in the shortest path case
the maximum that when you move away from the obstacle as far as possible.
Because you open God's perspective, so you know where the small T map. Can you help it find a way?
Note:
1, furthest away from the obstacle here is to ensure that at all times, the furthest away from the obstacle in ensuring the shortest path. Of course, you only need to ensure that small T
as large as possible at each location and the physical.
2, do not need to consider the way home from a small T
input format of
the first line of two numbers, representing the maximum physical size of the map where the small T and T are small.
Physique is a small T will occupy lattice.
Next lines each represent map numbers, where '1' represents disorder, '0' space.
The next row of three numbers represent the number of small food stores and coordinates T is located.
Next row, the first two numbers represent the coordinates food shop is located.
Output format
outputs two, and represents the shortest length and physical location of each.
data range
For 20% of the data, and the location of all food market position where the small T on a horizontal line.
For another 30% of the data, s = 0, where 20% of the data further satisfies n, m≤50
for the other 20% of data, P =. 1
** to 100% of the data, \ (n-, m \ Leq 300 \ ) , \ (S \ Leq 10 \) , \ (P \ Leq 15 ** \)
sample input 1

4 5 3
0 1 1 1 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 4 1
0 0

Sample Output

6 0

Sample input 2

4 6 3
1 1 1 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 4 1
3 0

Sample Output

7 5

A straight line that point:

Go sit, walk right and go left and right before you go to see which short

Physical: physical start from the largest decrease, to see which can build just finish all the food shop and do not run into obstacles

Shortest:

Traveling Salesman Problem

1569911886094

Expressed in binary (like pressure dp) for each point by not been, is transferred from the enumeration which each point over point (the minimum distance between two points may be required bfs)

\(f[s|1<<j][j]=f[s][i]+dis[i][j]\)

\ (S∪1 << j j transferred from coming \)

To find the distance between two points can be used when dp bfs

Physique

Set a size [x] [y], represented by the maximum volume of x to y

The current point x, if dis [x] [y] and dis [x] [ty] equal, then size (x, Y), size (x, ty), the larger the size of the selection as the current location ty point precursor

T3

Birthday (birthday.cpp / 1s / 256M)
Title Description
9102, scientists discovered a star called a wishing star, wishing star has a planet called summer outside far from the sun
star, physical and chemical properties on Summer Star and Earth-like, there's atmosphere, fit for human habitation.
Nanshan Kindergarten Summer Star's birthday party plans to field a lot.
There are n number of children, numbered 1 ~ n.
Every early birthday party president would choose [L, R] children in the interval to a birthday party, then decided by the principal teacher in
the selection of the selected children in a part of the children are divided into two sets, one set of kids partying morning, a set
close to the party of the children in the afternoon.
Number of children i initially wanted to gift the price of a [i], corresponding to the cost of the gift will provide a [i] +1, where 1
Dollar postage. When the morning to participate in the total cost of the gift of children and the children in the afternoon to participate in the total gift spending is not the same, it will
lead to parents dissatisfied party spending less children, so that they receive complaints.
Every teacher should be carefully selected to attend the party the party of the children, try to avoid complaints. Fang is now pregnant, and will break
the false for a long time, I want you to help her adoptive children in her class. Peng you not only responsible for a small division of a good birthday party of
friends, but also for floating purchasing gifts and gift investigations prices.
I believe that smart you will be able to solve this problem
input format
line three positive integers, respectively, n, m, v. Respectively, there are n children, birthday party gift or price
changes in a total of m times the initial price cap gift v.
After row n integers, the first integer i represents the i-th initial price for children gift ai.
After three lines each number m, opt, l, r.
1 indicates opt to hold a birthday party, the principal selected interval [l, r]. You will need two non-selection in [l, r] the
empty set X, Y, satisfy:
. 1, X and Y are disjoint, i.e., can not appear in the set of X and Y are set at the same time a child with
a child 2, there is provided a set of X is x, the cost of a [x] + 1, and the total cost of the set of requirements set Y X
equal to the total cost of the element.
If these two sets can be selected outputs Yes, if not output No.
opt for the gift 2 represents the price change. Interval [l, r] children from corresponding present price changes a [x] is
a [x] a [x] a [x]% V, i.e. the cubic mold interval v.
Output format
provided by c times the operation 1, c output lines, each string Yes or No indicating whether the two sets selected
row an integer, i.e., the answer

The sample is too long, so there is no sample qwq

1569922396387

60%:

Each little friends can be placed in a collection of x, y can also put the collection, you can also ignore this little friends (not selected)

For \ (r-l + 1 \ leq 7 \) data, we can enumerate the burst search

Here we are in the coefficients into the collection element x is 1, y into the collection of elements coefficients set to -1, then do not choose to 0, explosion and seek out the program and the number of 0

Obviously not fried complexity

Then consider \ (r-l + 1> 7 \) interval length

We need to find two sets of x, y, such that \ (\ sum_ {s \ in x} {a [s] +1} = \ sum_ {k \ in y} {a [k] +1} \)

First consider the set x

Each element has only two options selected and not selected, the interval length is set len, therefore, there will be \ (2 ^ {len} \ ) seed set, but considering the size of each element does not exceed v, so this section and at most, v * len,

Obviously when len is large enough, \ (2 ^ {len} \ geq v * len \) , this time, there are at least two sets will correspond to the same values go up, we can make these two sets respectively when the set a set of x and y

Manually extract at \ (len 2 ^ {} \ V GEQ * len, len \ Leq 14 \) , so that when the inquiry interval length $ \ geq $ 14 directly to the output Yes

When the interval length <14 when, how to do it?

Above, we solved the problem when the interval length of 7 and found that 14 * 7 = 2, so we can binary search

Each value may be recorded in the first half of the seizure, and the second half to see whether the seizure of the opposite of the first half of a value in any one of (0, should also be considered, three coefficients -1)

Like Jiang Zi:

Suppose we want for 3511 this set of data operations

In fact, the left half of the elements to consider: 35-3-50

Of course, the binary search may also be used map recorded on the items other bt's value corresponds to the state of the first half seized each, provided the title requires the first half + = t the second half, when the search half after, each of search to a value occurring before a half t-,

100%:

The segment tree out interval modification

Review: violent process (down to the bottom, and then combined)

Because the tag bundle stacked with big, so fast to put forward a similar power (multiplication) Laigao something like \ (a [i] ^ x \) such things

Guess you like

Origin www.cnblogs.com/lcez56jsy/p/11616015.html