Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions algorithmic/problems/147/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ The satisfaction level $p_i$ of company $i$ is determined as follows.
Your task is to determine the placement of the ads so that the sum of the satisfaction levels is maximized.
The raw task reward V is $10^9 \times \sum_{i=0}^{n-1} p_i / n$ rounded to the nearest integer. This is the raw reward V; final benchmark points are defined in Scoring.

![](./images/dbec47df66576ff9e5b5ace9df6d9110.png "Visualization of Sample Output")

Input
--------
Input is given from Standard Input in the following format:
Expand Down
16 changes: 1 addition & 15 deletions algorithmic/problems/148/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,7 @@ Takahashi starts from $(si, sj)$ and walks along a path satisfying the following
Each square has an integer value, and the score of a path is the sum of the values of the visited squares, including the square at the initial position.
Your goal is to find a path with as high a score as possible.

Examples
--------
<img src="./images/out1.svg" width=200>
<img src="./images/out2.svg" width=200>
<img src="./images/out3.svg" width=200>

Of the above three figures, only the path in the left figure satisfies the conditions.
In the middle figure, the same tile is stepped on twice in a row.
In the right figure, he left a tile once and then came back to the same tile.

<img src="./images/out.min.svg" width=1002>

Visualization result of the sample output.
The red circle represents the initial position, and the green circle represents the final position.
The tiles stepped on are painted in light blue.
Moving between two squares of the same tile is invalid, as is returning to a tile after leaving it.

Raw task objective
--------
Expand Down
4 changes: 1 addition & 3 deletions algorithmic/problems/151/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ We define that a road square $(i',j')$ is visible from $(i,j)$ if and only if th
- $i=i'$ and for every $j''$ with $\min(j,j')\leq j''\leq\max(j,j')$, $(i,j'')$ is a road square, or
- $j=j'$ and for every $i''$ with $\min(i,i')\leq i''\leq\max(i,i')$, $(i'',j)$ is a road square.

For example, in the figure below, the gray squares represent obstacles, the white and light yellow squares represent roads, and the road squares that are visible from the green circle are colored light yellow.

![](./images/1bc7c896310a65486d0ce3aa275f41b7.png "Example of visible squares")
In other words, visibility extends along the same row or column until an obstacle or the edge of the map is reached.

Your task is to find a route starting from a specified square $(si,sj)$, moving up, down, left, or right on road squares, and returning to $(si,sj)$, such that all the road squares become visible at least once.
The shorter the route, the higher the score.
Expand Down
10 changes: 5 additions & 5 deletions algorithmic/problems/154/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ We define a basic move as follows: move to a square chosen at random among the a

Each pet $i$ performs the following moves depending on $pt_i$, an integer value between $1$ and $5$ representing its type.

1. <img src="./images/cow.png" width="30" height="30" style="background-color:silver;image-rendering:pixelated"> Cow: Perform one basic move.
2. <img src="./images/pig.png" width="30" height="30" style="background-color:silver;image-rendering:pixelated"> Pig: Perform two basic moves.
3. <img src="./images/rabbit.png" width="30" height="30" style="background-color:silver;image-rendering:pixelated"> Rabbit: Perform three basic moves.
4. <img src="./images/dog.png" width="30" height="30" style="background-color:silver;image-rendering:pixelated"> Dog: Move toward a target person as follows. The first turn starts with no target. If it has no target, the target person is in the current position, or there exists no path to the target person, then it selects one person uniformly at random among those reachable from the current position, excluding those in the current position. If there is no such person, reset to no target and perform one basic move. Otherwise, move to an adjacent passable square that shortens the shortest distance to the target person (if there are multiple such squares, choose one of them uniformly at random), and then perform one basic move. If it reaches the destination after the first or the second move, reset to no target.
5. <img src="./images/cat.png" width="30" height="30" style="background-color:silver;image-rendering:pixelated"> Cat: Move toward a target square as follows. The first turn starts with no target. If it has no target or there exists no path to the target square, then it selects one square uniformly at random among those reachable from the current position, excluding the current position. If there exists no such square, do nothing. Otherwise, move to an adjacent passable square that shortens the shortest distance to the target square (if there are multiple such squares, choose one of them uniformly at random), and then perform one basic move. If it reaches the destination after the first or the second move, reset to no target.
1. Cow: Perform one basic move.
2. Pig: Perform two basic moves.
3. Rabbit: Perform three basic moves.
4. Dog: Move toward a target person as follows. The first turn starts with no target. If it has no target, the target person is in the current position, or there exists no path to the target person, then it selects one person uniformly at random among those reachable from the current position, excluding those in the current position. If there is no such person, reset to no target and perform one basic move. Otherwise, move to an adjacent passable square that shortens the shortest distance to the target person (if there are multiple such squares, choose one of them uniformly at random), and then perform one basic move. If it reaches the destination after the first or the second move, reset to no target.
5. Cat: Move toward a target square as follows. The first turn starts with no target. If it has no target or there exists no path to the target square, then it selects one square uniformly at random among those reachable from the current position, excluding the current position. If there exists no such square, do nothing. Otherwise, move to an adjacent passable square that shortens the shortest distance to the target square (if there are multiple such squares, choose one of them uniformly at random), and then perform one basic move. If it reaches the destination after the first or the second move, reset to no target.


Input Generation
Expand Down
30 changes: 2 additions & 28 deletions algorithmic/problems/155/statement.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,12 @@
Story
--------
A map like in the figure below is given.
Takahashi's home is located in the square with the red circle, and AtCoder's office is located in the square with the blue circle.
Takahashi commutes from his home to AtCoder's office on a grid map.
He memorizes his commuting route to the office as a string of characters such as DRDR, which means Down, Right, Down, and Right.
Because he is quite forgetful, he sometimes forgets some parts of the string he has memorized.
For example, if he forgets the third character, he will move down, right, and right, and will be lost without reaching the office.
For example, if he forgets the third character of DRDR, he will move down, right, and right instead, and may fail to reach the office.
Therefore, he decided to memorize a robust string that would allow him to reach the office with a high probability even if he forgets some parts of the string.
For example, if he memorizes a string DRDRDR, he can reach the office even if he forgets any one of the characters.
Your task is to find a string that will allow Takahashi to reach the office quickly and with a high probability.


<table>
<tr>
<td>
<figure style="text-align:center">
<img src="./images/f29506fb2_1.svg">
<figcaption>DRDR</figcaption>
</figure>
</td>
<td>
<figure style="text-align:center">
<img src="./images/f29506fb2_2.svg">
<figcaption>DR<del>D</del>R</figcaption>
</figure>
</td>
<td>
<figure style="text-align:center">
<img src="./images/f29506fb2_3.svg">
<figcaption>DR<del>D</del>RDR</figcaption>
</figure>
</td>
</tr>
</table>

Problem Statement
--------
You are given a map consisting of $20\times 20$ squares.
Expand Down
2 changes: 0 additions & 2 deletions algorithmic/problems/157/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ The trouble is, Takahashi had thrown away the instruction manual, so he lost the
According to his memory, the target picture was a <a href="https://en.wikipedia.org/wiki/Tree_(graph_theory)">tree</a>.
By repeating the sliding operation, please complete a tree.

![example](./images/example.gif)

Problem Statement
--------
There are $N^2-1$ tiles on an $N \times N$ board.
Expand Down
2 changes: 0 additions & 2 deletions algorithmic/problems/159/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ Problem Statement
--------
RectJoin is the following single-player game played with square grid paper and pencil.

![example](./images/example.gif)

Let $(0, 0)$ be the coordinates of the lower left corner of the grid paper, with the $x$-axis to the right and the $y$-axis to the top.
The coordinates of the upper right corner of the grid paper are $(N-1, N-1)$.
Initially, $M$ dots are placed on grid points, and you can repeat the following operations as many times as possible to place dots and draw rectangles on the grid paper.
Expand Down
19 changes: 2 additions & 17 deletions algorithmic/problems/160/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ He knows which flavor of candy each employee will put in by preliminary survey,
Since he is a clean freak, he will move the pieces of candy by tilting the box forward, backward, left, or right, just once for each piece of candy received, and eventually wants to make sure that the same type of candy is clustered together as much as possible.
Please help him by writing a program to determine the direction to tilt.

<figure>
<img src="./images/b639c75d_1.gif">
<figcaption>Example for $5\times 5$</figcaption>
</figure>


Problem Statement
--------
There is a box that can contain $10\times 10$ pieces of candy in a grid pattern.
Expand All @@ -24,10 +18,7 @@ You cannot change the order in which the pieces of candy are received.

Each time you receive one piece of candy, you must tilt the box forward, backward, left, or right exactly once.
When you tilt the box, each piece of candy moves in that direction simultaneously until it reaches the edge or hits another candy.
For example, if you tilt the box forward in the state shown in the left figure, the box will be in the state shown in the right figure.

![](./images/b639c75d_2.png)
![](./images/b639c75d_3.png)
For example, tilting the box forward packs the candies toward the front of each column while preserving their order within that column.

Raw task objective
--------
Expand All @@ -36,10 +27,6 @@ The formulas in this section define the raw reward V, not final benchmark points
We define the connectivity of pieces of candy as follows and consider the connected components.
> Two pieces of candy are connected if and only if they are of the same flavor and can reach each other through only pieces of candy of the same flavor in the four directions (front, back, left, right).

For example, the state in the figure below consists of $7$ connected components of size $\\{1, 1, 2, 2, 4, 6, 9\\}$.

![](./images/b639c75d_4.png)

Let $n_1,\cdots,n_k$ be the list of sizes of connected components in the final state after receiving 100 pieces of candy, and let $d_i$ be the total number of pieces of candy of flavor $i$.
The raw task reward V is

Expand All @@ -60,11 +47,9 @@ Each $f_t$ is an integer value between $1$ and $3$, representing the flavor of t
After reading the above information, repeat the following process $100$ times.

In the $t$-th process ($1\leq t\leq 100$), a single integer $p_t$ between $1$ and $101-t$ is given from Standard Input.
Let us number the empty cells from $1$ to $101-t$ in front-to-back and left-to-right priority, as shown in the example figure below.
Number the empty cells from $1$ to $101-t$ by scanning rows from front to back and, within each row, from left to right, skipping occupied cells.
Then the $t$-th piece of candy is placed in the $p_t$-th empty cell.

![](./images/b639c75d_5.png)

After reading $p_t$, by representing forward, backward, left, and right by `F`, `B`, `L`, and `R`, respectively, output a single character to Standard Output to indicate which direction to tilt the box.

<font color="red">**The output must be followed by a new line, and you have to flush Standard Output.**</font>
Expand Down
15 changes: 2 additions & 13 deletions algorithmic/problems/162/statement.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
Problem Statement
--------
There are $N(N+1)/2$ balls arranged in an $N$-tiered pyramid as shown in the figure below.
Let $(0, 0)$ be the coordinates of the ball at the top of the pyramid, and let $(x,y)$ be the coordinates of the $y (0\leq y\leq x)$-th ball from the left in the $x (0\leq x-1)$-th tier from the top.


<figure>
<img src="./images/d17182d7.png">
</figure>
There are $N(N+1)/2$ balls arranged in an $N$-tiered pyramid, with $x+1$ balls in tier $x$ for $0\leq x\leq N-1$.
Let $(0, 0)$ be the coordinates of the ball at the top of the pyramid, and let $(x,y)$ be the coordinates of the $y$-th ball from the left in the $x$-th tier from the top, using zero-based indices with $0\leq x\leq N-1$ and $0\leq y\leq x$.

Each ball is labeled with a number from $0$ to $N(N+1)/2-1$, and the numbers on each ball are all different.
You can swap two adjacent balls in six directions in a single operation.
Expand All @@ -23,12 +18,6 @@ Here, the balls at coordinates $(x_1,y_1)$ and $(x_2,y_2)$ are adjacent in six d
By performing this operation at most $10000$ times, please arrange the balls so that every ball $(x,y) (0\leq x\leq N-2, 0\leq y\leq x)$ except those in the lowest tier has a smaller number than the two balls $(x+1,y), (x+1,y+1)$ directly below it.
Please achieve this with as few operations as possible.


<figure>
<img src="./images/d17182d7.gif">
</figure>


Raw task objective
--------
The formulas in this section define the raw reward V, not final benchmark points. The Scoring section specifies the per-file award and its aggregation.
Expand Down
11 changes: 0 additions & 11 deletions algorithmic/problems/163/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@ He commissioned a contractor to create a draft of an accurate map, but the numbe
Mayor Takahashi, who loves graphs, is only interested in the adjacencies between the wards and thinks that the map could be drawn with fewer tiles if information other than adjacencies, such as the shape and size of each ward, is ignored.
Please create a map using as few tiles as possible.

<div style="display: flex; width: 100%;">
<div style="flex-basis: 40%; text-align: center; margin-right: 10%;">
<img src="./images/input.png" style="max-width: 100%; max-height: 100%; vertical-align: middle;">
<p>Accurate map</p>
</div>
<div style="flex-basis: 50%; text-align: center;">
<img src="./images/output.png" style="max-width: 100%; max-height: 100%; vertical-align: middle;">
<p>Small map correctly representing adjacencies</p>
</div>
</div>

Problem Statement
--------
Given a map of Takahashi City represented on a grid of $n\times n$ squares.
Expand Down
2 changes: 1 addition & 1 deletion algorithmic/problems/169/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ There is an $N\times N$ square board.
Let $(0, 0)$ be the coordinates of the top-left square, and $(i, j)$ be the coordinates of the square located $i$ squares down and $j$ squares to the right from there.
The set of squares $(i,0), (i,1), \dots, (i,N-1)$ is referred to as **row $i$**, and the set of squares $(0,j), (1,j), \dots, (N-1,j)$ is referred to as **column $j$**.

Initially, there are **Oni (demons)** <img src="./images/oni.png" width="25"> and **Fukunokami (fortune gods)** <img src="./images/fuku.png" width="25"> pieces on the board, with $2N$ pieces of each type, all placed on distinct squares.
Initially, there are **Oni (demons)** and **Fukunokami (fortune gods)** pieces on the board, with $2N$ pieces of each type, all placed on distinct squares.

You can select one row or column in a single operation and shift the chosen row/column by one square in either the left/right or up/down direction.

Expand Down
Loading