Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
実数 X.Y が与えられます。ただし Y はちょうど 1 桁です。
- 0 \leq Y \leq 2 ならば、X-
- 3 \leq Y \leq 6 ならば、X
- 7 \leq Y \leq 9 ならば、X+
と出力してください。
制約
- 1 \leq X \leq 15
- 0 \leq Y \leq 9
- X と Y は整数
入力
入力は以下の形式で標準入力から与えられる。
X.Y
出力
答えを出力せよ。
入力例 1
15.8
出力例 1
15+
15 + のような出力は不正解とみなされます。
X と + の間や、X と - の間には空白を入れずに出力してください。
入力例 2
1.0
出力例 2
1-
1.00 や 1 などの値が入力として与えられることはありません。
入力例 3
12.5
出力例 3
12
Score : 100 points
Problem Statement
You are given a real number X.Y, where Y is a single digit.
Print the following: (quotes for clarity)
- X-, if 0 \leq Y \leq 2;
- X, if 3 \leq Y \leq 6;
- X+, if 7 \leq Y \leq 9.
Constraints
- 1 \leq X \leq 15
- 0 \leq Y \leq 9
- X and Y are integers.
Input
Input is given from Standard Input in the following format:
X.Y
Output
Print the answer.
Sample Input 1
15.8
Sample Output 1
15+
Here, printing 15 + will not be accepted: do not print a space between X and +, or between X and -.
Sample Input 2
1.0
Sample Output 2
1-
You will not get inputs such as 1.00 and 1.
Sample Input 3
12.5
Sample Output 3
12
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
下の画像で示す図において、a 番の点と b 番の点が線で直接結ばれているかを答えてください。

制約
- 1 \leq a \lt b \leq 15
- a,b は整数
入力
入力は以下の形式で標準入力から与えられる。
a b
出力
a 番の点と b 番の点が線で直接結ばれているなら Yes、結ばれていないなら No を出力せよ。
入力例 1
1 2
出力例 1
Yes
問題文で示した図において、1 番の点と 2 番の点は線で直接結ばれています。 よって、Yes を出力します。
入力例 2
2 8
出力例 2
No
問題文で示した図において、2 番の点と 8 番の点は線で直接結ばれていません。 よって、No を出力します。
入力例 3
14 15
出力例 3
No
Score : 100 points
Problem Statement
Determine if there is a segment that directly connects the points numbered a and b in the figure below.

Constraints
- 1 \leq a \lt b \leq 15
- a and b are integers.
Input
The input is given from Standard Input in the following format:
a b
Output
Print Yes if there is a segment that directly connects the points numbered a and b; print No otherwise.
Sample Input 1
1 2
Sample Output 1
Yes
In the figure in the Problem Statement, there is a segment that directly connects the points numbered 1 and 2, so Yes should be printed.
Sample Input 2
2 8
Sample Output 2
No
In the figure in the Problem Statement, there is no segment that directly connects the points numbered 2 and 8, so No should be printed.
Sample Input 3
14 15
Sample Output 3
No
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
座標平面上に N 枚の長方形のシートが張られています。
各シートが覆う長方形領域の各辺はそれぞれ x 軸または y 軸と平行であり、
具体的には、i 枚目のシートはちょうど A_i \leq x\leq B_i かつ C_i \leq y\leq D_i をみたす領域全体を覆っています。
1 枚以上のシートによって覆われている領域 の面積を S とすると、
S は制約の条件下で整数となる事が証明できます。
S を整数の形で出力してください。
制約
- 2\leq N\leq 100
- 0\leq A_i<B_i\leq 100
- 0\leq C_i<D_i\leq 100
- 入力はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
N A_1 B_1 C_1 D_1 A_2 B_2 C_2 D_2 \vdots A_N B_N C_N D_N
出力
1 枚以上のシートによって覆われている領域の面積 S を整数で出力せよ。
入力例 1
3 0 5 1 3 1 4 0 5 2 5 2 4
出力例 1
20
3 枚のシートによって覆われている領域は次のようになります。
ここで、赤色・黄色・青色はそれぞれ 1 枚目・ 2 枚目・ 3 枚目のシートによって覆われている領域を表しています。

よって、1 枚以上のシートによって覆われている領域の面積は S=20 となります。
入力例 2
2 0 100 0 100 0 100 0 100
出力例 2
10000
異なるシートが同じ領域を覆っている事があることに注意してください。
入力例 3
3 0 1 0 1 0 3 0 5 5 10 0 10
出力例 3
65
Score : 200 points
Problem Statement
There are N rectangular sheets spread out on a coordinate plane.
Each side of the rectangular region covered by each sheet is parallel to the x- or y-axis.
Specifically, the i-th sheet covers exactly the region satisfying A_i \leq x\leq B_i and C_i \leq y\leq D_i.
Let S be the area of the region covered by one or more sheets. It can be proved that S is an integer under the constraints.
Print S as an integer.
Constraints
- 2\leq N\leq 100
- 0\leq A_i<B_i\leq 100
- 0\leq C_i<D_i\leq 100
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N A_1 B_1 C_1 D_1 A_2 B_2 C_2 D_2 \vdots A_N B_N C_N D_N
Output
Print the area S of the region covered by one or more sheets as an integer.
Sample Input 1
3 0 5 1 3 1 4 0 5 2 5 2 4
Sample Output 1
20
The three sheets cover the following regions.
Here, red, yellow, and blue represent the regions covered by the first, second, and third sheets, respectively.

Therefore, the area of the region covered by one or more sheets is S=20.
Sample Input 2
2 0 100 0 100 0 100 0 100
Sample Output 2
10000
Note that different sheets may cover the same region.
Sample Input 3
3 0 1 0 1 0 3 0 5 5 10 0 10
Sample Output 3
65
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
AtCoder では現在、 ABC , ARC , AGC , AHC の 4 つのコンテストが定期的に開催されています。
AtCoder で現在定期的に開催されているコンテストは S_1 , S_2 , S_3 とあと 1 つは何ですか?
制約
- S_1 , S_2 , S_3 はそれぞれ、
ABC,ARC,AGC,AHCのいずれかである。 - S_1 , S_2 , S_3 は相異なる。
入力
入力は以下の形式で標準入力から与えられる。
S_1 S_2 S_3
出力
答えを出力せよ。
入力例 1
ARC AGC AHC
出力例 1
ABC
ARC , AGC , AHC の 3つが入力として与えられているので、
残りの 1 つはABC です。
入力例 2
AGC ABC ARC
出力例 2
AHC
Score : 200 points
Problem Statement
AtCoder currently holds four series of regular contests: ABC, ARC, AGC, and AHC.
What is the series of regular contests currently held by AtCoder in addition to S_1, S_2, and S_3?
Constraints
- Each of S_1, S_2, and S_3 is
ABC,ARC,AGC, orAHC. - S_1, S_2, and S_3 are pairwise different.
Input
Input is given from Standard Input in the following format:
S_1 S_2 S_3
Output
Print the answer.
Sample Input 1
ARC AGC AHC
Sample Output 1
ABC
Given in input are ARC, AGC, and AHC. The rest is ABC.
Sample Input 2
AGC ABC ARC
Sample Output 2
AHC
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 300 点
問題文
1 から N の番号がついた N 人の人がいます。
人 i は数 Q_i が書かれたゼッケンを着けており、人 P_i を見つめています。
i が書かれたゼッケンを着けている人が見つめている人の着けているゼッケンにかかれている数を、i=1,2,\ldots,N のそれぞれについて求めてください。
制約
- 2 \leq N \leq 3\times 10^5
- 1 \leq P_i \leq N
- P_i は相異なる
- 1 \leq Q_i \leq N
- Q_i は相異なる
- 入力は全て整数である
入力
入力は以下の形式で標準入力から与えられる。
N P_1 P_2 \dots P_N Q_1 Q_2 \dots Q_N
出力
i が書かれたゼッケンを着けている人が見つめている人の着けているゼッケンにかかれている数を S_i とする。
S_1,S_2,\ldots,S_N をこの順に空白区切りで出力せよ。
入力例 1
4 4 3 2 1 2 3 1 4
出力例 1
3 4 1 2
人 3 は 1 が書かれたゼッケンを着けており、人 3 が見つめている人 2 は 3 が書かれたゼッケンを着けています。 よって i=1 に対する答えは 3 になります。

入力例 2
10 2 6 4 3 7 8 9 10 1 5 1 4 8 2 10 5 7 3 9 6
出力例 2
4 8 6 5 3 10 9 2 1 7
Score : 300 points
Problem Statement
There are N people numbered from 1 to N.
Person i is wearing a bib with the number Q_i and is staring at person P_i.
For each i = 1,2,\ldots,N, find the number written on the bib of the person that the person wearing the bib with number i is staring at.
Constraints
- 2 \leq N \leq 3\times 10^5
- 1 \leq P_i \leq N
- The values of P_i are distinct.
- 1 \leq Q_i \leq N
- The values of Q_i are distinct.
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N P_1 P_2 \dots P_N Q_1 Q_2 \dots Q_N
Output
Let S_i be the number written on the bib of the person that the person wearing the bib with number i is staring at.
Print S_1, S_2, \ldots, S_N in this order, separated by a single space.
Sample Input 1
4 4 3 2 1 2 3 1 4
Sample Output 1
3 4 1 2
Person 3 is wearing the bib with the number 1, and the person that person 3 is staring at, person 2, is wearing the bib with the number 3. Thus, the answer for i = 1 is 3.

Sample Input 2
10 2 6 4 3 7 8 9 10 1 5 1 4 8 2 10 5 7 3 9 6
Sample Output 2
4 8 6 5 3 10 9 2 1 7